小编Elg*_*ert的帖子

从AppDelegate启动ViewController

我有一个自定义URL方案,ViewController当我转到此URL时,我想打开一个不是根的某个.我已经能够做到这一点,剩下的是推动这一ViewControllernavigationControllerAppDelegate那里我处理我的网址是这样的:

- (BOOL)application:(UIApplication *)application
     openURL:(NSURL *)url
     sourceApplication:(NSString *)sourceApplication
     annotation:(id)annotation {

if ([[url scheme] isEqualToString:@"njoftime"]) {

    NSDictionary *getListingResponse = [[NSDictionary alloc]init];
    getListingResponse = [Utils getListing:[url query]];;

    if ([[getListingResponse objectForKey:@"status"] isEqualToString:@"success"]) {
         ListingViewController *listingView = [[ListingViewController alloc]init];
         [self.window.rootViewController.navigationController pushViewController:listingView animated:YES];
         return YES;
    }
Run Code Online (Sandbox Code Playgroud)

但它只启动我的应用程序,而不是ListingViewController我想要启动.知道我怎么能以不同的方式做到这一点?

uiviewcontroller ios appdelegate

12
推荐指数
2
解决办法
2万
查看次数

标签 统计

appdelegate ×1

ios ×1

uiviewcontroller ×1