问题
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