【发布时间】:2015-09-24 15:31:36
【问题描述】:
我的项目中有许多故事板,其中包含具有特定功能的模块。在我的一个故事板中,我有一个导航控制器,它推动另一个故事板的初始视图控制器。当我按下它时,导航栏会被移除,并且无法恢复这个特定的栏。当我在新的故事板中放置另一个导航控制器时,导航栏会重置为一个丑陋的过渡(它来自右侧并替换旧的)。
这就是我推动新故事板的视图控制器的方式:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:aStoryboardName bundle:nil];
UIViewController *SideBarInitialViewController = [storyboard instantiateInitialViewController];
UIStoryboardSegue *segue = [[GDFromRightCustomSegue alloc] initWithIdentifier:aSegueIdentifier source:aSource destination:SideBarInitialViewController];
[segue perform];
我还执行了自定义转场以摆脱基本动画(来自下方的视图):
UIView *sourceView = [self.sourceViewController view];
UIView *destinationView = [self.destinationViewController view];
CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
destinationView.frame = CGRectMake(screenWidth, 0.0, screenWidth, screenHeight);
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
[window insertSubview:destinationView aboveSubview:sourceView];
[UIView animateWithDuration:0.4 animations:^{
destinationView.frame = CGRectOffset(destinationView.frame, -screenWidth, 0.0);
sourceView.frame = CGRectOffset(sourceView.frame, -screenWidth, 0.0);
} completion:^(BOOL finished){
[self.sourceViewController presentViewController:self.destinationViewController animated:false completion:nil];
}];
有没有办法在不为导航栏设置动画的情况下推送新的故事板,或者更好的是,在我的新故事板中使用旧的导航控制器?
【问题讨论】:
标签: ios objective-c iphone cocoa-touch uinavigationcontroller