I have an array of NSStrings that in some circumstances,  I'd like to go 
through using fast enumeration starting with the second element in the array.  
After a bit of fooling around, I came up with the following, which seems to 
work:

        NSEnumerator *myEnumerator = [arrayOfLabels objectEnumerator];
        NSString *aString = [myEnumerator nextObject];  // gets us past the 
first element
        NSLog(@"the label is %@", aString);             // just to check; 
doesn't get used
                
        NSArray *arrayOfLabels = [myEnumerator allObjects];
 
        for (aString in arrayOfLabels) {
                // these are the strings that I'm interested in and will use
                NSLog(@"the label from enumeration is %@", aString);
        }
 

But I worry that in my inexperience with fast enumeration I may have committed 
a sin that is likely to bite me later, or that what I've done is really less 
effective than using an old-fashioned loop.  Perhaps some of you have run 
bench-marks or come up with a more elegant way of doing this sort of thing.

Many thanks for your insights,
Boyd
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to