【发布时间】:2013-09-22 17:48:48
【问题描述】:
我有一个MenuViewController 和一个UINavigationController 位于ViewDeck 中,这是一个侧边菜单框架。您只需像这样启动:
ListingViewController* lvc = [[ListingViewController alloc] init];
UINavigationController* homeNavStack = [[UINavigationController alloc] initWithRootViewController:lvc];
MenuViewController* sideMenu = [[MenuViewController alloc] init];
IIViewDeckController* slideController = [[IIViewDeckController alloc] initWithCenterViewController:homeNavStack leftViewController:sideMenu];
其中中心视图控制器是我的导航控制器,而菜单视图控制器隐藏在左侧,必须向左滑动才能使其可见(类似于 facebook 的侧边菜单)。
侧面菜单中有一个按钮,按下该按钮时,需要将应用程序转换回导航控制器,并让它推送一个新的视图控制器。这是我的代码,在MenuViewController.m:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.row == 0){
NSLog(@"check");
UserProfileViewController* userProfile = [[UserProfileViewController alloc] init];
[self.viewDeckController toggleLeftViewAnimated:YES];
[self.centerViewController pushViewController:userProfile animated:YES];
}
}
toggleLeftViewAnimated 带回中心视图控制器,再次隐藏侧边菜单。我给了侧边菜单一个对中心视图控制器的引用,并使用它,我要求它推送一个新的视图控制器。但是,当调用此方法时,中心视图控制器返回视图后没有任何反应。有谁知道为什么这不起作用?
【问题讨论】:
标签: iphone ios objective-c