iOS-使用URL方案打开某些视图控制器 [英] iOS - Open certain view controller with URL scheme

查看:96
本文介绍了iOS-使用URL方案打开某些视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用我的应用程序中的URL方案.我很轻松地打开了我的应用程序,只需将必要的项目添加到info.plist中.当前的网址"myappname://"将用户带到初始视图控制器FirstTableViewController,但是我想知道是否可以修改该URL方案,以便可以将用户带到某个视图控制器,例如ThirdTableViewController.我会将其用作启动中心之类的便捷功能.

I'm playing around with URL schemes in my app. I easily made one to open my app, just adding the necessary items to info.plist. This current URL "myappname://" takes the user to the initial view controller, FirstTableViewController, but I was wondering if it would be possible to modify that URL scheme so it I can have one that takes the user to a certain view controller, such as ThirdTableViewController. I would use this as a handy feature in something like Launch Center.

推荐答案

在... AppDelegate.m

In ...AppDelegate.m

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
MyViewController *controller = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
[self.viewController presentModalViewController:controller animated:YES];
[controller release];

return YES;        
}

这篇关于iOS-使用URL方案打开某些视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆