我有一个模态视图控制器,如下所示:
[self presentViewController:photo animated:YES completion:nil];
因此,照片是一个模态视图控制器,但是当它完成时,我想像这样推送到导航视图控制器:
[self dismissViewControllerAnimated:NO completion:^{
// UINavigationController *nav = [[UINavigationController alloc] init];
//nav.delegate = self;
ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[_nav pushViewController:profile animated:YES];
}];
nav是照片视图控制器中的一个属性,也具有委派权限。仍然没有工作,所以我错过了什么?
答案 0 :(得分:0)
虽然可以非常轻松地完成这件事情,但这不是很复杂,
在您正在呈现照片模式视图控制器的视图控制器中,显示带有这样的通知,
[self presentViewController:photo animated:YES completion:^{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToNextView:) name:@"someNotification" object:nil];
}];
通过调用此通知来关闭您的照片模式视图控制器,
[self dismissViewControllerAnimated:YES completion:^{
[[NSNotificationCenter defaultCenter] postNotificationName:@"someNotification" object:nil];
}];
现在你可以推送到另一个视图控制器,就像这样,
- (void) pushToNextView:(NSNotification *)notification {
//If you want some value from your notification
//NSDictionary *someValue = notification.object;
[self.navigationController pushViewController:ProfilesViewController animated:YES];
}