Launching ViewController from AppDelegate

后端 未结 6 2046
情书的邮戳
情书的邮戳 2021-02-03 09:51

I have a custom URL scheme and i want to open a certain ViewController which is not the root when i go to this URL. I have been able to do that and what remains is

6条回答
  •  礼貌的吻别
    2021-02-03 10:42

    If your using storyboard then you could use below lines for pushing your VC.

     UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
     YOURCLASS *obj=[storyboard instantiateViewControllerWithIdentifier:@"YOUR_CLASS_STORYBOARD_ID"];
    [self.window.rootViewController.navigationController pushViewController:obj animated:YES];
    

    Update:-

    ListingViewController *listingVC = [[ListingViewController alloc] init];
    UINavigationController *navCon = [[UINavigationController alloc] initWithRootViewController:listingVC];
    [self.window.rootViewController presentViewController:navCon animated:YES completion:nil];
    

提交回复
热议问题