预期“:”之前“]”令牌+被先前的错误弄糊涂,纾困

时间:2010-06-12 22:23:12

标签: iphone xcode sdk iphone-sdk-3.2

好的,我的智慧结束了。我已经尝试了所有可以想象的事情来摆脱这些错误

继承我的代码:

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic may go here. Create and push another view controller.
 /*
  //<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
  [self.navigationController pushViewController:detailViewController animated:YES];
  [detailViewController release];
  */
 NSInteger row = [indexPath.row];
 if (self.nameExcerptPage == nil) {
  NameOTWexcerpt *nameExcerptPageDetail = [[nameExcerptPage alloc] initWithNibName:@"NameOTWexcerpt" bundle:nil];
  self.nameExcerptPage = nameExcerptPageDetail;
  [nameExcerptPageDetail release];

 nameExcerptPage.title = [NSString stringWithFormat:@"%&", [TheBookNavTabs objectAtIndex:row]];

 Rothfuss_ReaderAppDelegate *delegate = [[UIApplication sharedApplication] delegate];
 [delegate.SecondTableViewController pushViewController:TheBookNavTabs animated:YES];
 }
}

并出现错误,显示“NSInteger row = [indexPath.row];

请帮忙!谢谢!

2 个答案:

答案 0 :(得分:3)

NSInteger row = [indexPath.row];

点符号或[],但不是两者!

thyrgle先得到了它......

stringWithFormat中使用的“%&”格式说明符让我有点困惑。那应该是%@吗? %&是真正的格式说明符吗?它有什么作用?谷歌,它什么都不做......

答案 1 :(得分:0)

好的是我将其更改为[indexPath row]并且有效。

我不确定%&amp;,我从教程中得到它并且它有效。这就是我所知道的全部