#pragma mark- add 20151112 导航动画时间太短导致崩溃,重写UINavigationcontroller以下相关方法

 

- (id)navigationLock; ///< Obtain "lock" for pushing onto the navigation controller

 

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated navigationLock:(id)navigationLock; ///< Uses a horizontal slide transition. Has no effect if the view controller is already in the stack. Has no effect if navigationLock is not the current lock.

- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated navigationLock:(id)navigationLock; ///< Pops view controllers until the one specified is on top. Returns the popped controllers. Has no effect if navigationLock is not the current lock.

- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated navigationLock:(id)navigationLock; ///< Pops until there's only a single view controller left on the stack. Returns the popped controllers. Has no effect if navigationLock is not the current lock.

 

 

 

 

 

 .m文件

 

#pragma mark- add 20151112 导航动画时间太短导致崩溃,重写以下相关方法

 

- (id)navigationLock

{

    return self.topViewController;

}

 

- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated navigationLock:(id)navigationLock

{

    if (!navigationLock || self.topViewController == navigationLock)

        [self pushViewController:viewController animated:animated];

}

 

- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated navigationLock:(id)navigationLock

{

    if (!navigationLock || self.topViewController == navigationLock)

        return [self popToRootViewControllerAnimated:animated];

    return @[];

}

 

- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated navigationLock:(id)navigationLock

{

    if (!navigationLock || self.topViewController == navigationLock)

        return [self popToViewController:viewController animated:animated];

    return @[];

}

 

相关文章:

  • 2022-12-23
  • 2021-11-20
  • 2022-01-31
  • 2021-06-15
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2021-11-04
  • 2021-10-18
  • 2022-12-23
  • 2021-04-23
相关资源
相似解决方案