【发布时间】:2012-06-01 10:03:56
【问题描述】:
在表格单元格视图中显示 xml 解析数据时出现此语义问题。应用程序运行成功,但是当我选择任何行时,应用程序会在当时应用程序崩溃时进入详细视图。请帮忙!!!
这行第三种情况出现语义问题
cell.textLabel.text = aBook.bookID;
应用代码:
- (UITableViewCell *)tableView:(UITableView *)tv
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell =
[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
}
switch (indexPath.section) {
case 0:
cell.textLabel.text = aBook.name;
break;
case 1:
cell.textLabel.text = aBook.author;
break;
case 2:
cell.textLabel.text = aBook.price;
break;
case 3:
cell.textLabel.text = aBook.bookID;
break;
}
return cell;
}
【问题讨论】:
标签: objective-c