我有一个模式视图控制器,它是这样表示的:
[self presentViewController:photo animated:YES completion:nil];因此,photo是一个模式视图控制器,但当它完成后,我想推送到一个导航视图控制器,如下所示:
[self dismissViewControllerAnimated:NO completion:^{
// UINavigationController *nav = [[UINavigationController alloc] init];
//nav.delegate = self;
ProfilesViewController *profile = [[ProfilesViewController alloc] init];
[_nav pushViewController:profile animated:YES];
}];nav是照片的视图控制器中的一个属性,也有委派。仍然不能工作,那么我遗漏了什么?
发布于 2014-10-12 16:45:26
不要把事情复杂化,因为它可以很容易地完成,
在呈现照片模式视图控制器的视图控制器中,使用如下的通知来呈现它,
[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];
}https://stackoverflow.com/questions/26323230
复制相似问题