【发布时间】:2013-11-10 11:24:07
【问题描述】:
我正在编写一个侧面菜单,就像 Facebook 应用程序中的联系人菜单一样。我希望当用户选择一个联系人时,菜单关闭并且 TopViewController 推送聊天。问题是使用下面的代码,它只会关闭菜单。
"Menu.m"
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"chat"];
[self.slidingViewController.topViewController.navigationController pushViewController:controller animated:YES];
[self.slidingViewController resetTopView];
}
【问题讨论】:
-
您应该记录您的一些实体(self.slidingViewController、self.slidingViewController.topViewController 和 self.slidingViewController.topViewController.navigationController)以查看是否有任何实体。
-
我会做的,我会告诉你一些事情。
-
我明白了:Self.slidingViewController.topviewcontroller.navigationcontroller: (null)。但我不明白为什么,因为如果我在 TopViewController 中调用此方法,它会起作用。
-
你知道为什么它是空的吗? @rdelmar
-
不,不是没有看到你的应用程序的结构。
标签: ios uiviewcontroller menu uinavigationcontroller pushviewcontroller