Reputation: 3324
My app crashes when I scroll the UITableView over the first cell or the last cell!
Why this is happening? I add with addObject:name the objects of the UItableview . This is the code I use at cellForRowAtIndexPath
. Help please! I have been trying to figure out what is going wrong hours!
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString * DisclosureButtonCellIdentifier =
@"DisclosureButtonCellIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:
DisclosureButtonCellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier: DisclosureButtonCellIdentifier]
autorelease];
}
NSUInteger row = [indexPath row];
NSString *rowString =nil;
rowString = [list objectAtIndex:row];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
[rowString release];
return cell;
Upvotes: 0
Views: 1504
Reputation: 45598
You are calling [rowString release];
but you never retained it.
Upvotes: 3
Reputation: 13427
Is it throwing an exception - my guess is the index is not set:
rowString = [list objectAtIndex:row];
Can you set a breakpoint on this line and dump the "list"?
Upvotes: 0