我在我的应用程序中尝试使用 URL 方案。我很容易制作了一个打开我的应用程序,只需将必要的项目添加到 info.plist。当前的 URL“myappname://”将用户带到初始 View Controller FirstTableViewController,但我想知道是否可以修改该 URL 方案,以便我可以拥有一个将用户带到某个 View Controller 的方案,比如 ThirdTableViewController。我会将其用作 Launch Center 之类的便捷功能。
最佳答案
这篇文章有点旧,但可能对 iOS 5 + 有用,因为检查的答案不正确。
AppDelegate 没有任何 navigationController 属性。
相反,您可以在 AppDelegate.m 中执行:
enter code here
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
MyViewController *controller = [[MyViewController alloc] initWithNibName:@"MyViewController" bundle:[NSBundle mainBundle]];
UINavigationController *navController = (UINavigationController *)self.window.rootViewController;
[navController presentModalViewController:controller animated:YES];
return YES;
}
关于iOS - 使用 URL 方案打开某些 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10925612/