简体   繁体   English

在Storyboard中以编程方式呈现ViewController

[英]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... 我正在尝试在情节提要中以编程方式呈现ViewController,我正在使用下面提到的代码,但是它不起作用,没有给我任何回应...

- (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];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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