Using presentViewController from UIView

后端 未结 5 476
鱼传尺愫
鱼传尺愫 2020-12-13 14:52

I am creating a title bar for my iOS application and I am making this inside a UIView. The only issue I am having is with the \"home button\". When the home button is presse

5条回答
  •  旧时难觅i
    2020-12-13 15:37

    You can try below code

     UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
     ViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"ViewController"];
     UIViewController *vc1 = [UIApplication sharedApplication].keyWindow.rootViewController;
     [vc1 presentViewController:vc animated:YES completion:nil]; 
    

提交回复
热议问题