Re: NSEnumerator
Re: NSEnumerator
- Subject: Re: NSEnumerator
- From: Clark Cox <email@hidden>
- Date: Fri, 27 Jan 2006 15:24:15 -0500
You have one semicolon too many
On 1/27/06, Adam Johnson <email@hidden> wrote:
> -(id)init;
> {
> items = [[NSMutableArray array] retain];
> [items addObject:[[NSImage alloc] init]];
> [items addObject:[[NSImage alloc] init]];
> [items addObject:[[NSImage alloc] init]];
> [items addObject:[[NSImage alloc] init]];
> return self;
> }
> -(void)doSomethingTrivial:(id)sender;
> {
> NSEnumerator *enumerator = [items objectEnumerator];
> NSImage *aCell;
Remove the semicolon from this line:
> while(aCell = [enumerator nextObject]);
> {
> int index = [items indexOfObject:aCell];
> NSLog(@"%i %i",[items indexOfObject:aCell],[items count]);
> }
> }
>
> The NSLog() prints something in the 4 billion ballpark. Also, the
> enumerator only enumerates the first object. What am I doing wrong?
>
> --Adam Johnson
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
Clark S. Cox III
email@hidden
My CV/Resume:
http://homepage.mac.com/clarkcox3/files/Resume.pdf
http://homepage.mac.com/clarkcox3/files/Resume.html
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >NSEnumerator (From: Adam Johnson <email@hidden>) |