当我滚动UITableView通过第一个单元格或最后一个单元格时,我的应用程序崩溃! 这是为什么发生?我用addObject添加:命名UItableview的对象。这是我在cellForRowAtIndexPath
使用的代码。请帮助!我一直在想弄清楚什么是错误的时间!应用程序崩溃在cellForRowAtIndexPath
- (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;
请在代码周围使用
块。 – 2010-01-13 16:05:09请将代码分配给列表数组,并发布以下方法 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)部分 – FelixLam 2010-01-13 16:06:34