简体   繁体   中英

presenting ViewController Programmatically in Storyboard

i'm trying to present viewcontroller programmatically in storyboard, i'm using the below mentioned code but it's not working, doesn't give me any response...

- (void)buttonPressed
{
NSLog(@"called");

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];

UINavigationController *vc = [sb instantiateViewControllerWithIdentifier:@"123"];

vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self.navigationController presentModalViewController:vc animated:YES];
}

what am i missing here?

NSLog(@"called");

    UIStoryboard *sb = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];

    UINavigationController *vc = [sb instantiateInitialViewController];

    vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    [self presentViewController:vc animated:YES completion:nil];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM