After the iOS8, with Uialertcontroller This class, the following
Ns_class_available_ios (8_0) @interface uialertcontroller: uiviewcontroller
Obviously, Apple strongly recommended that the vast number of yards farmers if you can not use Uialertview, because we have uialertcontroller!
Go to the chase ...
In order to be compatible with IOS7, Uialertview is used uniformly in our project. The problem is: (one in the project) TextField is in the edit state (keyboard on the interface), click on a button in the interface to perform a certain action, I first put the keyboard, the keyboard closed the code of execution is this
[Self.view Endediting:yes];
The code that pops up a uialertview is then executed, and after clicking the OK button on the Uialertview, it is dismiss off. At this time, the keyboard and magically bounce out!!!
Look at the real machine. System version number: 9.2.1. This problem did not occur when testing with another real machine (System version 8.1.2).
So Baidu a bit, after the verification, the following code can solve the problem I encountered
if(Ios_systemversion >=8.0) {Uialertcontroller*alertcontroller = [Uialertcontroller alertcontrollerwithtitle:@"title"Message@"message"Preferredstyle:uialertcontrollerstylealert]; Uialertaction*okaction = [Uialertaction actionwithtitle:@"Determine"Style:uialertactionstyledefault handler:^ (Uialertaction *action) { }]; [Alertcontroller addaction:okaction]; [Self Presentviewcontroller:alertcontroller animated:yes completion:nil]; } Else{Uialertview*alert = [[Uialertview alloc] Initwithtitle:@"title"Message@"message" Delegate: Nil Cancelbuttontitle:nil Otherbuttontitles:@"Determine", nil]; [Alert show]; }
A netizen is saying this: After iOS 8.3, dismiss Alert view will attempt to restore the previous keyboard input.
This should be an imperfect place in the iOS system high version when dealing with Uialertview. However, fortunately the problem can be solved!
Reference: http://www.cnblogs.com/android-wuwei/p/4685960.html
http://blog.csdn.net/ul123dr/article/details/50385929
http://www.cocoachina.com/bbs/read.php?tid=307336&page=e& #a
Bug report: The keyboard that was closed after Uialertview disappeared and popped up again