Show view from storyboard chain

£可爱£侵袭症+ 提交于 2019-12-10 23:58:03

问题


I have a chain in storyboard and I want to start (for example) second view when I have first launching app. I have some code, which only work in

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

method, if I put it in

- (void)viewDidLoad

method it's not work,

the code which show my other view is:

UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"someId"];
[vc setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

How can I show view, which have place in chain in storyboard when app have first launching?


回答1:


Try your code in -(void)viewDidAppear:(BOOL)animated.

For further information on the iOS viewcontroller lifecycle head over to UIViewController class reference




回答2:


If you are using a navigation controller, you can simply push the second view onto the navigation stack. If you are not using a navigation controller, then you could force a segue to the next view from the loading.



来源:https://stackoverflow.com/questions/8623524/show-view-from-storyboard-chain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!