iOS7 nested push animation can result in corrupted

在iOS7中,開啓push/pop view controller 動畫遇到一個問題,就是在快速切換屢次後會在console出現一個問題ios

nested push animation can result in corrupted navigation bar multiple warning

Unbalanced calls to begin/end appearance transitions for
app


查了一些資料後,找到了一個方法:
動畫

0)找到push/pop view controller 動畫結束的回調。ui

UINavigationControllerDelegate代理中的spa

-(void)navigationController:(UINavigationController *)navigationController
      didShowViewController:(UIViewController *)viewController
                   animated:(BOOL)animated

1)找到是否接受點擊方法的方法。.net

UIGestureRecognizerDelegate中的代理

-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch


應用以上兩個代理方法,加上一個BOOL的flag值,能夠控制是否處罰pop/pushcode

當動畫完成時,將flag設置爲容許pop/push, shouldReceiveTouch直接返回flag值。blog

在點擊事件時,要注意更改flag值再也不接受其餘事件,防止在flag爲YES時的屢次點擊。事件


參考連接:

http://stackoverflow.com/questions/11813091/nested-push-animation-can-result-in-corrupted-navigation-bar-multiple-warning

http://www.taofengping.com/2013/12/26/ios7_barbuttonitem_navigation_gesture/

http://blog.csdn.net/lengshengren/article/details/12616217

http://stackoverflow.com/questions/10150231/how-to-detect-when-uinavigationcontroller-animation-has-finished

相關文章
相關標籤/搜索