0
我有一個有兩個項目的tabbar應用程序。這兩個不同的標籤欄項目包含2個不同的導航控制器。 第一個導航控制器工作正常,但是當我想將視圖推到第二個導航時,它會生成 「應用程序嘗試將nil視圖控制器推到目標上」。將視圖推到第二個導航控制器
這裏是我把視圖推向第二個導航控制器的代碼。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
TabNavAppDelegate *appDelegate = (TabNavAppDelegate *)[[UIApplication sharedApplication] delegate];
JJ_MapAnnotation *anno = (JJ_MapAnnotation *) [depotsArray objectAtIndex:indexPath.row];
if(self.secondViewController ==nil)
{
SecondViewController *secView = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
self.secondViewController == secView;
[self.secondViewController.map addAnnotation:anno];
[secView release];
}
secondViewController.title = [NSString stringWithFormat:@"%@", [anno title]];
[appDelegate.navController pushViewController:secondViewController animated:YES];
嗨感謝您的快速回復,但即使我刪除代碼,它仍然會產生同樣的錯誤 – EnginBodur 2010-11-09 15:43:44
大聲笑。愚蠢的錯誤;)檢查我更新的答案。 – nacho4d 2010-11-09 15:52:18
謝謝夥伴,你讓我的日子=))讚賞!!! – EnginBodur 2010-11-09 15:57:52