如何深度链接到从 UITabBarViewController 中的 UINavigationController 中的 UIViewController 访问的 UIViewController?
How to deeplink to a UIViewController accessed from a UIViewController in a UINavigationController in a UITabBarViewController?
我需要深入链接到一个 UIViewController,它可以从位于 UINavigationViewController 中的另一个 UIViewController 访问,而 UINavigationViewController 本身就是 UITable[=26] 中的一个选项卡=].
基本上是这样的
UITabBarViewController -> (Each Tab) UINavigationController -> UIViewController -> (Press UIBarButtonItem) -> TheViewControllerIWant
由于我正在进行的项目的限制,这一切都是在我的 AppDelegate 中以编程方式创建的。我无法使用故事板来解决这个问题。
这是我现有的代码。它让我到达 ViewController,但没有给我导航回选项卡
中的 ViewController 的方法
- (BOOL) application: (UIApplication * ) application openURL: (NSURL *) url sourceApplication: (NSString *) sourceApplication annotation: (id) annotation {
if ([url.scheme isEqualToString: @"myApp"]) {
if ([url.host isEqualToString: @"account"])
{
self.window.rootViewController = [[EditAccountViewController alloc] init];
}
}
我也试过这个作为开始,但无法从 TabBar 中的那个向前导航到下一个 ViewController:
- (BOOL) application: (UIApplication * ) application openURL: (NSURL *) url sourceApplication: (NSString *) sourceApplication annotation: (id) annotation {
if ([url.scheme isEqualToString: @"myApp"]) {
if ([url.host isEqualToString: @"account"])
{
[_tabBarController setSelectedIndex:0];
self.window.rootViewController = _tabBarController;
}
}
}
我如何完成这个
那么你需要手动触发所有动作....
所以您首先需要 select TabBarController 上的第一个选项卡
然后你需要获取第一个选项卡的 UIViewController 并在 Navigation Controller 中推送目的地 ViewController...
[_tabBarController setSelectedIndex:0];
UIViewController *myVC = self.tabBarController.viewControllers.firstObject;
UIViewController *destinationVC = [[UIViewController alloc] initWithNibName:@"vc.nib" bundle:[NSBundle mainBundle]];
[myVC.navigationController pushViewController:destinationVC animated:YES];
我需要深入链接到一个 UIViewController,它可以从位于 UINavigationViewController 中的另一个 UIViewController 访问,而 UINavigationViewController 本身就是 UITable[=26] 中的一个选项卡=].
基本上是这样的
UITabBarViewController -> (Each Tab) UINavigationController -> UIViewController -> (Press UIBarButtonItem) -> TheViewControllerIWant
由于我正在进行的项目的限制,这一切都是在我的 AppDelegate 中以编程方式创建的。我无法使用故事板来解决这个问题。
这是我现有的代码。它让我到达 ViewController,但没有给我导航回选项卡
中的 ViewController 的方法- (BOOL) application: (UIApplication * ) application openURL: (NSURL *) url sourceApplication: (NSString *) sourceApplication annotation: (id) annotation {
if ([url.scheme isEqualToString: @"myApp"]) {
if ([url.host isEqualToString: @"account"])
{
self.window.rootViewController = [[EditAccountViewController alloc] init];
}
}
我也试过这个作为开始,但无法从 TabBar 中的那个向前导航到下一个 ViewController:
- (BOOL) application: (UIApplication * ) application openURL: (NSURL *) url sourceApplication: (NSString *) sourceApplication annotation: (id) annotation {
if ([url.scheme isEqualToString: @"myApp"]) {
if ([url.host isEqualToString: @"account"])
{
[_tabBarController setSelectedIndex:0];
self.window.rootViewController = _tabBarController;
}
}
}
我如何完成这个
那么你需要手动触发所有动作....
所以您首先需要 select TabBarController 上的第一个选项卡 然后你需要获取第一个选项卡的 UIViewController 并在 Navigation Controller 中推送目的地 ViewController...
[_tabBarController setSelectedIndex:0];
UIViewController *myVC = self.tabBarController.viewControllers.firstObject;
UIViewController *destinationVC = [[UIViewController alloc] initWithNibName:@"vc.nib" bundle:[NSBundle mainBundle]];
[myVC.navigationController pushViewController:destinationVC animated:YES];