Re: update a tableView from a different class
Re: update a tableView from a different class
- Subject: Re: update a tableView from a different class
- From: Martin Batholdy <email@hidden>
- Date: Thu, 05 May 2011 03:40:13 +0200
On 05.05.2011, at 03:35, Graham Cox wrote:
> Have you checked to see whether removeObjectAtIndex:1 actually succeeds? If the index is out of bounds, an exception will be thrown and -reloadData will never be reached. You can easily check that in the debugger. It looks suspicious that you are hard-coding an index value for an array whose contents are variable.
>
> If you always want to remove the first object, the correct index is 0, but even that will fail if the array is empty. If you always want to remove the last object, use [NSArray lastObject], which will return nil if the array is empty. In general, naming a method -updateView that also removes an object from <content> is setting yourself up for buggy behaviour. Either separate out the removal from the update, or else rename the method so it's clear what it actually does.
>
> —Graham
>
Yes, I checked this with an NSLog statement.
The 1 is also only for testing purpose and the array has always more than two entries.
So [table reloadData]; gets executed but has no effect ...
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden