iOS-使用URL方案打开某些视图控制器 [英] iOS - Open certain view controller with URL scheme
问题描述
我正在使用我的应用程序中的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屋!