IOS Keyboard Recycling--in Lan Yi education

Source: Internet
Author: User

Method One:

1. Turn off the keyboard

[[[UIApplication sharedapplication] Keywindow] endediting:yes];

Presumably everyone has encountered a view on a lot of input boxes, in order to close the soft keyboard pop-up to traverse and then call Resignfirstresponder it? I found a key today. The keyboard that may be open on this view is simple: [Self.view endediting:yes];

It's straight OK.

Method Two:

2. Turn off the keyboard

[[Self findfirstresponderbeneathview:self] resignfirstresponder];

[[Self findfirstresponderbeneathview:self] becomefirstresponder];//open keyboard

-(uiview*) Findfirstresponderbeneathview: (uiview*) view

{

Search recursively for first responder

For (UIView *childview in view.subviews) {

if ([Childview respondstoselector: @selector (Isfirstresponder)] && [Childview Isfirstresponder])

return childview;

UIView *result = [self findfirstresponderbeneathview:childview];

if (result)

return result;

}

return nil;

}

IOS Keyboard Recycling--in Lan Yi education

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.