【问题标题】:complicated Transation in ViewControllers from different UINavigationController in UITabBarController来自 UITabBarController 中不同 UINavigationController 的 ViewControllers 中的复杂事务
【发布时间】:2015-03-16 20:31:08
【问题描述】:

UITabBarController
|
+- UINavigationController1
| |
| +- UIViewController11
| |
| +- UIViewController12(后退按钮名为“BackBtn”)
+- UINavigationController2
|
+- UIViewController21
|
+- UIViewController22(名为“BtnB”的按钮)

  • (a)在 UIViewController22 中有一个名为“BtnB”的按钮,当我触摸它时屏幕会显示 myViewController12 和 UIViewController22 PushViewTo UIViewController12 之类的动画;
  • (b)在(a)之后,我触摸BackBtn(在UIViewController12中),屏幕将显示UIViewController11,并且像UIViewController12这样的动画会弹出到UIViewController11。
  • 问:通过以下页面我们可以实现: iOS - go to second uiviewcontroller of some tab from another tab 但是有人可以更优雅地实现它吗?

【问题讨论】:

    标签: ios objective-c


    【解决方案1】:

    我解决了。 在myViewController12中,我将BackBtn的action方法设置为如下代码:

    -(IBAction)backAction:(id)sender
    {
            self.tabBarController.selectedIndex = 0;
            CATransition* transition = [CATransition animation];
            [transition setDuration:0.3];
            transition.type = kCATransitionPush;
            transition.subtype = kCATransitionFromLeft;
            [transition setFillMode:kCAFillModeBoth];
            [transition setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
            [self.tabBarController.view.layer addAnimation:transition forKey:kCATransition];
            [self.navigationController popToRootViewControllerAnimated:NO];
    }

    【讨论】:

      猜你喜欢
      • 2011-03-01
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多