Simple ios_8_keyboard Processing
Finally:
<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + PGJyPgo8L3A + cjxwpda-vcd4kphagy2xhc3m9 "p1"> BeyondViewController. h
//// BeyondViewController. h // 9 _ Simple keyboard processing /// Created by beyond on 14-7-25. // Copyright (c) 2014 com. beyond. all rights reserved. // # import
@ Interface BeyondViewController: UIViewController-(IBAction) exitKeyboard :( UIButton *) sender; @ end
BeyondViewController. m
//// BeyondViewController. m // 9 _ keyboard simple processing/* problems: 1. the pop-up keyboard may cover the controls on the interface. Solution: Use scrollView, or, dynamically reduce the Y value of the control (move above) 2. Click events of the two buttons on the toolBar, which have not yet been implemented * // Created by beyond on 14-7-25. // Copyright (c) 2014 com. beyond. all rights reserved. // # import "BeyondViewController. h "@ interface BeyondViewController () {// attached toolBar UIToolbar * _ toolBar on the keyboard;} @ end @ implementation BeyondViewController-(void) viewDidLoad {[super viewDidLoad]; // Add a toolbar [self addToolBarForKeyboard] for all keyboards;} // Add a toolbar for all keyboards-(void) addToolBarForKeyboard {// load xib for mainBundel without specifying the extension. xib NSArray * arrayXibObjects = [[NSBundle mainBundle] loadNibNamed: @ "KeyToolBar" owner: nil options: nil]; // KeyToolBar _ toolBar = arrayXibObjects [0]; // self. set toolBar NSArray * array = self. view. subviews; for (UIView * obj in array) {if ([obj isKindOfClass: [UITextField class]) {// Why do I want to convert it better, because the attribute inputAccessoryView of UIView is readOnly UITextField * obj2 = (UITextField *) obj; obj2.inputAccessoryView = _ toolBar;} // It is the 1st UIToolbarTextButton (the previous button) in the toolBar) add a click event // [[_ toolBar. subviews firstObject] addTarget: self action: @ selector (previuskeyboard :) forControlEvents: UIControlEventTouchUpInside]; // Add a click event for the 2nd UIToolbarTextButton (Next button) in the toolBar // [_ toolBar. subviews objectAtIndex: 2] addTarget: self action: @ selector (nextKeyboard :) forControlEvents: UIControlEventTouchUpInside]; // Add the click event [[_ toolBar. subviews lastObject] addTarget: self action: @ selector (exitKeyboard :) forControlEvents: UIControlEventTouchUpInside];} // In the toolBar, click the previous button-(void) previuskeyboard :( UIButton *) sender {NSLog (@ "click the previous button to activate the previous input box");} // In the toolBar, click the next button-(void) nextKeyboard :( UIButton *) sender {NSLog (@ "click the next button to activate the next input box");} // exit the keyboard-(IBAction) exitKeyboard :( UIButton *) sender {// Method 1: self. all text boxes inside the view (including child widgets ...) both quit the first responder [self. view endEditing: YES]; return; // Method 2: // traverse all controls in the uiview, resignFirstResponder/* for (int I = 0; I
KeyToolBar. xib