我试图以编程方式 popViewcontroller 通过这样做
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
[[self navigationController] popViewControllerAnimated:YES];
}
问题是我在这个 VC 中有 textFields。如果 textField 处于事件状态并且键盘正在显示,并且如果我显示 AlertView 并使用命令退出键盘([[self view] endEditing:YES] 或[textField resignFirstResponder]
)。然后调用命令 popViewControllerAnimated:YES 。当前 VC 被解散,但在父 VC 出现后短暂。键盘将显示大约 1 秒,然后消失。
这种行为很烦人。无论如何要解决这个问题?我注意到通过使用 [[self navigationController] popViewControllerAnimated:NO]
键盘不会出现。但我更喜欢在我的应用程序中使用动画。
请帮忙。
提前致谢
最佳答案
我通过制作 [[self navigationController] popViewControllerAnimated:YES] 解决了这个问题;调用时延迟。
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 100 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
[[self navigationController] popViewControllerAnimated:YES];
});
关于ios - PopViewController 动画 :YES when tap on UIAlertView make Keyboard appear in parentVC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29762703/