Wednesday, July 31, 2013

iOS7 > Lesson#9b - Appendix1 - First Responder

When users touch a text field, a text view, or a field in a web view, the system displays a keyboard. You can configure the type of keyboard that is displayed along with several attributes of the keyboard. 




Several different keyboard types
Several different keyboard types





Several different keyboards and input methods
Several different keyboards and input methods

The keyboard cannot hide the portion of your view by default that is the focus of editing. In order to hide the keyboard, we need to write coding in .m file.

Usually, there are two common ways to hide keyboard:

1) When you click Return Button
-(IBAction)doneEditing:(id)sender{
    [inputText resignFirstResponder];
}

2) When you click any part of view
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    //UITouch *touch = [touches anyObject];
    [inputText resignFirstResponder];
}


For more details, please find the following official website from Apple Developer: 
https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html

http://www.techotopia.com/index.php/Writing_iOS_5_Code_to_Hide_the_iPhone_Keyboard

No comments:

Post a Comment