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]; }
One of the heroes said this: after iOS 8.3, dismiss Alert view will attempt to restore the previous keyboard input. But one thing I don't understand is that I executed the code of the keyboard!!! Apple, you tell me, this is not a system-level bug ...
To write yesterday. In Baidu, there is a friend asked such a question: A interface has a textview, in the editing state (there is a keyboard) when I click the button, the processing of the button has to end all the control edit (close the keyboard) operation, and then pop Alertview, Click the Alerview dialog box pop to the B interface, now found pop to B interface will appear after the pop-up keyboard and then disappear, if I remove the pop-up Alertview this operation, click the button after the direct pop will not appear this problem.
This, I personally experimented, found that this phenomenon is also a high-version system in the processing of uialertview when the phenomenon showed.
A warrior said to use nstimer,0.25 seconds (keyboard to put up the animation time), then go to pop, like the following
Self.mytimer = [Nstimer scheduledtimerwithtimeinterval:0.25 target:self selector: @selector ( Poptopreviousviewcontroller) Userinfo:nil Repeats:no];
There are suggestions like this
[Self performselector: @selector (POPVC) withobject:nil afterdelay:0.25];
can solve the problem.
But my advice is this.
if(Ios_systemversion >=8.0) {Uialertcontroller*alertcontroller = [Uialertcontroller alertcontrollerwithtitle:@"Alert"Message@"l AM Alert"Preferredstyle:uialertcontrollerstylealert]; Uialertaction*action = [Uialertaction actionwithtitle:@"l know"Style:uialertactionstyledefault handler:^ (Uialertaction *_nonnull Action) {[Self.navigationcontroller popviewcontrolleranimated:yes]; }]; [Alertcontroller addaction:action]; [Self Presentviewcontroller:alertcontroller animated:yes completion:nil]; } Else{[Self.navigationcontroller popviewcontrolleranimated:yes]; Uialertview*alertview = [[Uialertview alloc] Initwithtitle:@"Alertview"Message@"l AM Alertview" Delegate: Nil Cancelbuttontitle:@"Pop"Otherbuttontitles:nil]; [Alertview show]; }
All right, just write it down here!
From this beginning, I will be the entire iOS Development Bug report series, welcome everyone attention!
This article references: 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 log (1): The keyboard that was closed after Uialertview disappears