Launching ViewController from AppDelegate

后端 未结 6 2042
情书的邮戳
情书的邮戳 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:45

    Your AppDelegate.m should look like this:

    #import "TestViewController.h"
    
    @interface AppDelegate ()
    
    @property (strong, nonatomic) TestViewController *viewController;
    
    @end
    
    @implementation AppDelegate
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
      self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
      self.viewController = [[TestViewController alloc]init];
      self.window.rootViewController = self.viewController;
      [self.window makeKeyAndVisible];
    
      return YES;
    }
    

提交回复
热议问题