當我滾動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