Bug report: The keyboard that was closed after Uialertview disappeared and popped up again

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.