テーブルセルビューにxml解析データを表示しているときに、このセマンティックの問題が発生しました。アプリケーションは正常に実行されますが、任意の行を選択すると、アプリが詳細表示され、アプリがクラッシュします。plsは助けます!!!
この行 の3番目のケースでセマンティックの問題が発生します
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;
}