標籤:
代碼為
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"感謝你對我們提出的意見或建議,你的支援就是我們進步的動力!" delegate:self cancelButtonTitle:@"我知道了" otherButtonTitles:nil, nil];[alert show];-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex==0) { [self backForward]; }}
效果
這是因為alertView的動畫和鍵盤動畫起衝突了
解決方案分為兩種
①用UIAlertController,適用於ios8以後
②若還是想用UIAlertView,那麼可以用如下方法
alertview show的時候寫個主線程延遲,pop也延遲
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"感謝你對我們提出的意見或建議,你的支援就是我們進步的動力!" delegate:self cancelButtonTitle:@"我知道了" otherButtonTitles:nil, nil];dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.4f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [alert show];});
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ if (buttonIndex==0) { [self performSelector:@selector(backForward) withObject:nil afterDelay:0.25f]; }}
好了的效果如下
ios8以後,使用UIAlertViw時pop/push頁面後,鍵盤閃一下的問題