0

それはUIalertViewデリゲートメソッドalertView:didDismissWithButtonIndex:それは途切れ途切れだと(Xcodeの7.3.1を使用して)高速に内部で行うのとき、私はこの方法popViewControllerAnimated:でアニメーションに問題を抱えています。なぜ誰も理解できますか?途切れアニメーション:alertViewから:didDismissWithButtonIndex:

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 
{ 
    if (buttonIndex != alertView.cancelButtonIndex) 
    { 
     // animation of popViewControllerAnimated: is not working correctly 
     [self.navigationController popViewControllerAnimated:YES]; 
    } 
} 

奇妙なことは、このコードは問題なく動作することです:

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 
{ 
    if (buttonIndex != alertView.cancelButtonIndex) 
    { 
     // code is running om main thread 
     if ([[NSThread currentThread]isMainThread]) { 
      // still - by using GCD and go to main thread, the animation works!! 
      dispatch_async(dispatch_get_main_queue(), ^{ 
       [self.navigationController popViewControllerAnimated:YES]; 
      }); 
     } 
    } 
} 

そして、この:

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { 

    if(buttonIndex != alertView.cancelButtonIndex) 
    { 
     // no problem with animation when done in alertView:clickedButtonAtIndex: 
     [self.navigationController popViewControllerAnimated:YES]; 
    } 
} 

私はUIAlertViewはしばらくの間、廃止されていることを知って、それが可能そのための?このコードは2012年からアプリで修正されず、最近奇妙な動作を開始しました。

答えて

1

あなたは、私はこれがあなた

+0

はい、おかげでそれはclickedButtonAtIndex 'と同様:)働くのに役立ちます願っています!、[OK]を、この作品の代わりに私のためにdidDismissWithButtonIndex

- (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex { if (buttonIndex != alertView.cancelButtonIndex) { [self.navigationController popViewControllerAnimated:YES]; } } 

willDismissWithButtonIndexで試すことができます:' Iとして質問に書いた。しかし、私は 'didDismissWithButtonIndex:'の問題点についてまだ困惑しています.... – turingtested

関連する問題