2010-06-12 73 views
0

好吧,即時在我的智慧結束在這裏。我已經試過所有可以想象的事情來擺脫這些錯誤的預計「:」之前「]」令牌+以前的錯誤困惑,救助

繼承人我的代碼:

- (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的行= [indexPath.row];

請幫助!謝謝!

+1

我不知道如何對你有很大的幫助,但是,你不能使用。 indexPath.row中的運算符。你有沒有嘗試過。運營商? – 2010-06-12 22:27:02

回答

3
NSInteger row = [indexPath.row]; 

無論點符號或[]而不是兩個!

thyrgle第一次...

stringWithFormat中使用的「%&」格式說明符讓我有點困惑。應該是%@%&是一個真正的格式說明符?它有什麼作用?谷歌,它什麼也沒有...

0

好吧,我改變它到[indexPath行],它的工作。

我不確定關於%&,我從教程中得到了它,它可以工作。這就是我所知道的

+0

你不明白的每個符號都是一個會在屁股上咬你的bug。在「nameExcerptPage.title」中放入的唯一東西是一個&字符。這個「%&」幾乎可以肯定是一個「%@」(shift-5,shift-2) – willc2 2010-06-21 14:08:09

相關問題