Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-10-2010, 08:44 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Location: Michigan, United States
Posts: 132
natronp is on a distinguished road
Default looping and paging every 16 iterations

I need to add some very basic paging within a for loop. I'd like to loop through an array and shove groups of 16 into their own separate arrays.

Does anyone have an objective c modulus (modulo?) operator/paging example i can look at?

Don't come from a computer science background and that one (modulo) has so far escaped me...

thanks for any help!
natronp is offline   Reply With Quote
Old 08-10-2010, 09:46 AM   #2 (permalink)
Registered Member
 
Join Date: Oct 2009
Location: Amsterdam, The Netherlands
Posts: 782
TUX2K is on a distinguished road
Default

%
TUX2K is offline   Reply With Quote
Old 08-10-2010, 09:47 AM   #3 (permalink)
Registered Member
 
Join Date: Oct 2009
Location: Amsterdam, The Netherlands
Posts: 782
TUX2K is on a distinguished road
Default

Ok that one was a but small.

Just do some thing like:
Code:
if( i % 2 = 0)
{
}
TUX2K is offline   Reply With Quote
Old 08-10-2010, 09:49 AM   #4 (permalink)
Registered Member
 
Join Date: Jun 2010
Location: Michigan, United States
Posts: 132
natronp is on a distinguished road
Default

Code:
if( i % 16 = 0)
{
}
so within my loop, this statement would catch each time i hit a multiple of 16?
natronp is offline   Reply With Quote
Old 08-10-2010, 09:53 AM   #5 (permalink)
Registered Member
 
Join Date: Oct 2009
Location: Amsterdam, The Netherlands
Posts: 782
TUX2K is on a distinguished road
Default

Yes, that seems correct.
With one minor change:
Code:
if( i % 16 == 0)
{
}
= is assignment
== is compare.

My bad.
TUX2K is offline   Reply With Quote
Old 08-10-2010, 10:48 AM   #6 (permalink)
Registered Member
 
Join Date: Jun 2010
Location: Michigan, United States
Posts: 132
natronp is on a distinguished road
Default no biggie i know what you meant!

Yeah, i saw/caught that... thanks!

one more thing... do you know how to create/init an array with a dynamically created reference/name?

i.e.:

NSMutableArray *["array"+i] = [[NSMutableArray alloc]init];

I need to create a new/unique array within my loop when ever i get to 16...

thanks!



Quote:
Originally Posted by TUX2K View Post
Yes, that seems correct.
With one minor change:
Code:
if( i % 16 == 0)
{
}
= is assignment
== is compare.

My bad.
natronp is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 331
9 members and 322 guests
bignoggins, Chickenrig, firecall, iNet, linkmx, michaelhansen, Objective Zero, PlutoPrime, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,893
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 12:37 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0