我提出UIViewController
,如:導航控制器始終是零
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
PhotoViewController *resultVC = [storyboard instantiateViewControllerWithIdentifier:NSStringFromClass([PhotoViewController class])];
[self.navigationController presentViewController:resultVC animated:YES completion:^{}];
我已經登錄控制檯,結果是:
po self.navigationController
<UINavigationController: 0x9c3e920>
但是,當我在PhotoViewController
類我已經登錄控制檯和結果:
po self.navigationController
nil
其零。我不知道爲什麼會發生這種情況。我也有這個,但它的零總是:
[self presentViewController:resultVC animated:YES completion:^{}];
我不想推控制器。我想呈現控制器。 –
爲什麼? NavigationController只能推送和Poped。如果您需要另一個動畫,可以使用CATransition: 'CATransition * transition = [CATransition animation]; transition.duration = 0.2f; transition.type = kCATransitionMoveIn; transition.subtype = kCATransitionFromLeft; [[[[self.navigationController.view subviews] objectAtIndex:0] layer] addAnimation:transition forKey:kCATransition];' – Bimawa
第二,您可以在PhotoViewController類(如UINavigationController)中創建屬性。並寫入它self.navigationController。但它不好實際。我們都需要知道你想要什麼? – Bimawa