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] initWi开发者_StackOverflow社区thStyle:UITableViewCellStyleDefault
reuseIdentifier: DisclosureButtonCellIdentifier]
autorelease];
}
NSUInteger row = [indexPath row];
NSString *rowString =nil;
rowString = [list objectAtIndex:row];
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
[rowString release];
return cell;
You are calling [rowString release];
but you never retained it.
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"?
精彩评论