Ios 自动移动到父视图控制器
我正在我的应用程序中使用mmdrawercontroller…当我从抽屉中选择tableviewcell时,我在导航控制器上按tableview a,然后在从tableview a中选择tableviewcell时,我在导航控制器上按tableview B…tableview B出现,然后立即弹回到tableview a 我调试了tableview B的viewdidload方法,导航控制器将tableview B与tableview A和home view一起推到它上面…tableview B的所有tableview方法也被触发…但后来不知何故,tableview B弹出并返回tableview A。。。 这种奇怪的行为有什么原因吗 注意 然而,当我通过自定义创建的uinavigational控制器(通过下面的代码片段)以模态方式呈现时,它的行为正常..并且不会弹出Ios 自动移动到父视图控制器,ios,objective-c,uitableview,uinavigationcontroller,mmdrawercontroller,Ios,Objective C,Uitableview,Uinavigationcontroller,Mmdrawercontroller,我正在我的应用程序中使用mmdrawercontroller…当我从抽屉中选择tableviewcell时,我在导航控制器上按tableview a,然后在从tableview a中选择tableviewcell时,我在导航控制器上按tableview B…tableview B出现,然后立即弹回到tableview a 我调试了tableview B的viewdidload方法,导航控制器将tableview B与tableview A和home view一起推到它上面…tableview B
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:tableviewB];
[self presentViewController:navigationController
animated:YES
completion:^{
NSLog(@"presenting modally rather pushing");
}];
因此,导航控制器肯定出了一些问题。如果要从tableViewA中推送tableViewB,请在AppDelegate中分享我用swift编写的想法:
self.window = UIWindow()
let tvc = TableViewAController()
let nvc = UINavigationController(rootViewController: tvc)
window.rootViewController = nvc
window.makeKeyAndVisible()
当您要在tableViewA中推送tableViewB时:
let nextVC = TableViewBController()
nvc.pushViewController(nextVC)