我是iOS開發新手,對變量有疑問。我試圖用標籤欄和導航控制器編寫應用程序,標籤欄是rootViewController。我已經建立了我的應用程序來包含一個包含我的表視圖行爲的.plist,一個UITableViewController和一個詳細視圖控制器。當我在我的應用程序委託中定義導航控制器時,我繼續在初始表視圖控制器的實現文件中出現一個錯誤。調用在不同文件頭中定義的變量?
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@"Children"];
if([Children count] == 0) {
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
}
else {
//Prepare to tableview.
IndustryTableViewController *industryTableViewController = [[IndustryTableViewController alloc] initWithNibName:@"IndustryTableViewController" bundle:[NSBundle mainBundle]];
//Increment the Current View
industryTableViewController.CurrentLevel += 1;
//Set the title;
industryTableViewController.CurrentTitle = [dictionary objectForKey:@"Title"];
//Push the new table view on the stack
[self.indNavControl pushViewController:industryTableViewController animated:YES];
industryTableViewController.tableDataSource = Children;
[industryTableViewController release];
}
}
我得到的錯誤,當我推堆棧上的新表視圖。我正在導入我的應用程序委託的頭文件,但它仍然不起作用,給我錯誤,「變量沒有在TableViewController.h中定義」。有沒有辦法讓我召喚這個變量,還是有更有效的方法來解決這個問題?
在此先感謝,我真的可以使用任何幫助你給我。