How to call a View Controller programmatically?

前端 未结 8 2289
孤街浪徒
孤街浪徒 2020-12-02 07:04

I have looked at all the tutorials I can find on this one, and I still don\'t have the answer. I need to call another view from the code. I am using UIStoryboards

8条回答
  •  误落风尘
    2020-12-02 07:45

    main logic behind this is_,

    NSString * storyboardIdentifier = @"SecondStoryBoard";
    
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:storyboardIdentifier bundle: nil];
    
    UIViewController * UIVC = [storyboard instantiateViewControllerWithIdentifier:@"YourviewControllerIdentifer"];
    
    [self presentViewController:UIVC animated:YES completion:nil];
    

提交回复
热议问题