Self-created solve the problem of keyboard last Exit

Source: Internet
Author: User

take the modal controller as an example:Under normal circumstances, if the keyboard is displayed in the interface, dismiss the current controller, then the controller's view will first exit, the keyboard will be more than the controller's view delay exit. Workaround: Exit the keyboard before dismiss the controller view, and then dismiss the controller's view[self. View endediting:YES]; [self dismissviewcontrolleranimated:YES completion:nil]; Although the above two lines of code solve the problem, but will find that the controller's view is dismiss, leaving the interface of the animation execution faster than before-the flashback. To solve the problem of the controller's view quick flash.  a better approach://Exit the keyboard first, delay0.2Seconds laterAgainDismissController
[Self.ViewEndediting:YES];

Dispatch_after(Dispatch_time(Dispatch_time_now, (int64_t)(0.2*Nsec_per_sec)),Dispatch_get_main_queue(), ^{

[Self dismissviewcontrolleranimated:YES completion:nil];

    });

Self-creation solves the problem of the keyboard last exit

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.