UITabBarController 内的 UINavigationController,导航控制器中有多个视图
我有一个 UINavigationController
,它有一个 UITableViewController
作为根视图。 UINavigationController
位于 UITabBarController
内。
在 UITableViewController (*viewOne) 中,如果我单击一个单元格,则会运行以下代码
UIViewController *newView = [[UIViewController alloc] initWithNibName:@"newView" bundle:nil];
[self.navigationController pushViewController:newView animated:YES];
[newView release];
然后,newView 内部是:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
NSLog(@"%@", self.navigationController);
}
return self;
}
日志有:
[8947:207] (null)
如果我尝试将新的视图控制器推送到 navigationController,则什么也不会发生。有什么线索吗?
I've got a UINavigationController
that has a UITableViewController
as it's root view. The UINavigationController
is inside a UITabBarController
.
In the UITableViewController (*viewOne), if I click a cell a the following code runs
UIViewController *newView = [[UIViewController alloc] initWithNibName:@"newView" bundle:nil];
[self.navigationController pushViewController:newView animated:YES];
[newView release];
Then, inside of newView is:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
NSLog(@"%@", self.navigationController);
}
return self;
}
The logs have:
[8947:207] (null)
And if I try to push a new view controller to the navigationController, nothing happens. Any clues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经弄清楚了。
在我的应用程序委托中,我添加了一个新属性:
在 IB 中,我已将 profileNavigationController 从应用程序委托连接到导航控制器。
现在,在推动新观点时,我会这样称呼:
I've figured it out.
In my application delegate, I've added a new property:
And in IB, I've connected the profileNavigationController from the app delegate to Navigation Controller.
And now, when pushing new views, I call: