IOS keyboard hidden, next textField, keyboard control third-party easy-to-use IQKeyboardManager

Source: Internet
Author: User

IOS keyboard hidden, next textField, keyboard control third-party easy-to-use IQKeyboardManager
Effect

Usage

When using a keyboard, you will often encounter many problems, such as the absence of hidden keyboard and many inconvenient usage. Here we will bring you a third-party library.

IQKeyboardManager * manager = [IQKeyboardManager sharedManager]; manager. enable = YES; // determines whether the entire function is enabled. Manager. shouldResignOnTouchOutside = YES; // controls whether to hide the keyboard on the click background. // controls whether the toolbar text color on the keyboard is customized. shouldToolbarUsesTextFieldTintColor = YES; // controls whether to display toolbar on the keyboard. Manager. enableAutoToolbar = YES;

When we use it, we only need to ensure that these lines of code can be called. We can put it into the appdelegate class for one loading, and then we don't need to change it later, of course, if you make some adjustments, you need to apply new settings. I usually put them in the first class after appdelegate is run, or the place where the keyboard is used for the first time.

Extension:

# Import "ViewController. h "@ interface ViewController () @ property (nonatomic, strong) handler * returnKeyHandler; @ end @ implementation ViewController-(void) viewDidLoad {[super viewDidLoad]; // set returnKeyHandler, you can click the next key on the keyboard to automatically jump to the next input box. In the last input box, Click done to automatically collapse the keyboard. Self. returnKeyHandler = [[IQKeyboardReturnKeyHandler alloc] initWithViewController: self]; self. returnKeyHandler. lastTextFieldReturnKeyType = UIReturnKeyDone; self. returnKeyHandler. toolbarManageBehaviour = IQAutoToolbarBySubviews;}-(void) dealloc {self. returnKeyHandler = nil;} @ end

This library supports many things, such as UITextField, UITextView, UIWebView, UIScrollView, UITableView, and UICollectionView.

Related Article

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.