{"id":4105,"date":"2010-02-17T15:41:32","date_gmt":"2010-02-17T10:11:32","guid":{"rendered":"http:\/\/mobisoftinfotech.com\/?p=4105"},"modified":"2024-11-22T11:44:29","modified_gmt":"2024-11-22T06:14:29","slug":"iphone-uitextfield-tutorial-handling-keyboard-interactions","status":"publish","type":"post","link":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions","title":{"rendered":"iPhone UITextField Tutorial: Handling Keyboard Interactions"},"content":{"rendered":"<p>This post is written to provide you with the process to get the return button working on the keypad that pops up while filling a text field, the \u201cBackground Tap\u201d functionality, and also what to do when the text field hides behind the keypad.<\/p>\n<p>First we make a demo <a href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-view-based-application-from-scratch\">View-based Application<\/a> for this, say \u201cBackgroundTapForBlog\u201d .<br>Add a text field to BackgroundTapForBlogViewController.xib, declare it in your BackgroundTapForBlogViewController.h file ,say tfUsername and link them in .xib.<\/p>\n<h3><b>Return Button on KeyPad:<\/b><\/h3>\n<p>Once you are done with this, add a function \u201ctextFieldDoneEditing\u201d to the BackgroundTapForBlogViewController.m file, and do not forget to declare it in the BackgroundTapForBlogViewController.h file. This function gets rid of the keypad once you are done filling in the textfield.<\/p>\n<h5><b>BackgroundTapForBlogViewController.h file &#8211;<\/b><\/h5>\n<pre>[objc highlight=\"3,5,6,7\"]\n#import &amp;amp;amp;amp;amp;amp;amp;amp;lt;UIKit\/UIKit.h&amp;amp;amp;amp;amp;amp;amp;amp;gt;\n@interface BackgroundTapForBlogViewController: UIViewController{\nUITextField *tfUsername;\n}\n@property(nonatomic, retain) IBOutlet UITextField *tfUsername;\n-(IBAction) textFieldDoneEditing : (id) sender;\n-(IBAction) backgroundTap:(id) sender;\n@end\n[\/objc]<\/pre>\n<h5><b>BackgroundTapForBlogViewController.m file &#8211;<\/b><\/h5>\n<pre>[objc highlight=\"4,7,11,15,16,17,19,20,21\"]\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;BackgroundTapForBlogViewController.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n\n@implementation BackgroundTapForBlogViewController\n@synthesize tfUsername;\n\n- (void)viewDidUnload {\nself.tfUsername = nil;\n}\n\n- (void)dealloc {\n[tfUsername release];\n[super dealloc];\t\t\t\n}\n\t\n-(IBAction) textFieldDoneEditing : (id) sender{\n[sender resignFirstResponder];\n}\n\n-(IBAction) backgroundTap:(id) sender{\n[self.tfUsername resignFirstResponder];\n}\n@end\n[\/objc]<\/pre>\n<p>Now, save your project (Command+S).<br>Finally, open BackgroundTapForBlogViewController.xib again and link the \u201ctextFieldDoneEditing\u201d function from File&#8217;s Owner to your text field\/fields, and select \u201cDidEndOnExit\u201d option.<br><\/p><h5><strong>Linking textFieldDoneEditing<\/strong><\/h5><br><a href=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png\"><noscript><img decoding=\"async\" class=\"size-medium wp-image-331\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22-300x163.png\" alt width=\"400\" height=\"220\"><\/noscript><img decoding=\"async\" class=\"size-medium wp-image-331 lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E\" alt width=\"400\" height=\"220\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22-300x163.png\"><\/a>\n<h3><b>Background Tap Functionality:<\/b><\/h3>\n<p>Other than the return button on the keypad, we do provide an option that the keypad should disappear if the user touches the background. This is done as follows &#8211;<br>Now go back to Xcode and declare a function \u201cbackgroundTap\u201d in the BackgroundTapForBlogViewController.h file and add it to BackgroundTapForBlogViewController.m file.<\/p>\n<pre>[objc]\n-(IBAction) backgroundTap:(id) sender{\n[self.tfUsername resignFirstResponder];\n}\n[\/objc]<\/pre>\n<p>This function gets rid of the keypad. ResignFirstResponder notifies the receiver(in this case, tfUsername) that it is supposed to give up its status as first responder in the current window.<br>Save your project (Command+S).<br>Now, open BackgroundTapForBlogViewController.xib. Select UIView from the Main Window of Interface Builder and press Command+2 (open Connection Inspector). You will notice there is no option like touch up inside. So you need to change the class from UIView to UIControl in Identity Inspector (Command + 4). UIView is extended from UIControl, now events like touch up inside can be detected on a UIControl. Hence, this change.<br>Then select File&#8217;s Owner and link the function \u201cbackgroundTap\u201d to the background of your view, and select option \u201cTouch Up Inside\u201d with UIControl.<br>\n<\/p><h5><strong>Connecting backgroundTap function<\/strong><\/h5><br><a href=\"https:\/\/mobisoftinfotech.com\n\/blog\/wp-content\/uploads\/2010\/02\/Picture-13.png\"><noscript><img decoding=\"async\" class=\"size-medium wp-image-330\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-13-300x165.png\" alt width=\"400\" height=\"220\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-13-300x165.png 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-13.png 917w\" sizes=\"(max-width: 400px) 100vw, 400px\"><\/noscript><img decoding=\"async\" class=\"size-medium wp-image-330 lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E\" alt width=\"400\" height=\"220\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E 400w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-13-300x165.png 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-13.png 917w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-13-300x165.png\"><\/a>\n<h3><b>Text Field Hiding behind keypad: <\/b><\/h3>\n<p>When the text field\/fields begin hiding behind the keypad, it becomes necessary to scroll up so that the text field would be visible while filling it from the keypad.<br>For this, we need to include 5 files viz.,<br>MIBackgroundTapDelegate.h,<br>MIScrollView.h<br>MIScrollView.m<br>ScrollableViewController.h<br>ScrollableViewController.m<\/p>\n<p>Add these files to your project, and follow the instructions &#8211;<\/p>\n<h5><b>BackgroundTapForBlogViewController.h &#8211; <\/b><\/h5>\n<p>Extend our controller from \u201cScrollableViewController\u201d. We no longer need a declaration for backgroundTap function, since we are implementing MIBackgroundTapDelegate which has a declaration for the same.<\/p>\n<pre>[objc highlight=\"2,3,5,10\"]\n#import &amp;amp;amp;amp;amp;amp;amp;amp;lt;UIKit\/UIKit.h&amp;amp;amp;amp;amp;amp;amp;amp;gt;\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;ScrollableViewController.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;MIBackgroundTapDelegate.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n\t\t\n@interface BackgroundTapForBlogViewController:ScrollableViewController &amp;amp;amp;amp;amp;amp;amp;amp;lt;MIBackgroundTapDelegate&amp;amp;amp;amp;amp;amp;amp;amp;gt; {\nUITextField *tfUsername;\n}\n@property(nonatomic, retain) IBOutlet UITextField *tfUsername;\n-(IBAction) textFieldDoneEditing : (id) sender;\n\/\/-(IBAction) backgroundTap:(id) sender;\n@end\n[\/objc]<\/pre>\n<h5><b>BackgroundTapForBlogViewController.m file-<\/b><\/h5>\n<pre>[objc highlight=\"6,7\"]\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;BackgroundTapForBlogViewController.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n\n@implementation BackgroundTapForBlogViewController\n@synthesize tfUsername;\n- (void)viewDidLoad {\nself.svScrollViewM.contentSize = CGSizeMake(320,416);\n[self registerForEditingEvents:tfUsername];\n[super viewDidLoad];\n}\n\t\n- (void)viewDidUnload {\nself.tfusername = nil;\n}\n- (void)dealloc {\n[tfUsername release];\n[super dealloc];\n}\n-(IBAction) textFieldDoneEditing : (id) sender{\n[sender resignFirstResponder];\n}\n-(IBAction) backgroundTap:(id) sender{\n[self.tfUsername resignFirstResponder];\n}\n@end\n&amp;amp;amp;amp;amp;amp;amp;amp;lt;\/objc&amp;amp;amp;amp;amp;amp;amp;amp;gt;\n\n&amp;amp;amp;amp;amp;amp;amp;amp;lt;b&amp;amp;amp;amp;amp;amp;amp;amp;gt;MIBackgroundTapDelegate.h -&amp;amp;amp;amp;amp;amp;amp;amp;lt;\/b&amp;amp;amp;amp;amp;amp;amp;amp;gt;\nWe declare a protocol for backgroundtap function.\n\n[objc]\n@protocol MIBackgroundTapDelegate \n- (IBAction)backgroundTap:(id)sender;\n@end\n[\/objc]<\/pre>\n<h5><b>ScrollableViewController.h &#8211;<\/b><\/h5><p><br>Declare properties and functions for the scroll view controller.<\/p>\n<pre>[objc]\n#import \n\n@interface ScrollableViewController : UIViewController {\nUIControl * ctrlKeyboardFocusFieldM;\nBOOL bKeyboardShownM;\nUIScrollView * svScrollViewM;\n}\n\n@property (nonatomic, retain) UIControl * ctrlKeyboardFocusFieldM;\n@property (nonatomic, retain) IBOutlet UIScrollView * svScrollViewM;\n\n- (void) registerForEditingEvents:(UIControl *) aControl;\n- (void) registerForKeyboardNotifications;\n- (void) keyboardWasHidden:(NSNotification*)aNotification;\n- (void) keyboardWasShown:(NSNotification*)aNotification;\n- (void) textFieldDidBeginEditing:(UITextField *)textField;\n- (void) textFieldDidEndEditing:(UITextField *)textField;\n@end\n[\/objc]<\/pre>\n<h5><b>ScrollableViewController.m &#8211;<\/b><\/h5>\n<pre>[objc]\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;ScrollableViewController.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n@implementation ScrollableViewController\n@synthesize ctrlKeyboardFocusFieldM;\n@synthesize svScrollViewM;\n- (void)viewDidLoad {\n[self registerForKeyboardNotifications];\n[super viewDidLoad];\n}\n- (void)didReceiveMemoryWarning {\n\/\/ Releases the view if it doesn&amp;#039;t have a superview.\n[super didReceiveMemoryWarning];\n}\n- (void)viewDidUnload {\nself.ctrlKeyboardFocusFieldM = nil;\nself.svScrollViewM = nil;\n}\n- (void)dealloc {\n[ctrlKeyboardFocusFieldM release];\n[svScrollViewM release];\n[super dealloc];\n}\n- (void)registerForKeyboardNotifications\t{\n[[NSNotificationCenter defaultCenter] addObserver:self\n selector:@selector(keyboardWasShown:)\t\t\t\t\t name:UIKeyboardDidShowNotification object:nil];\n[[NSNotificationCenter defaultCenter] addObserver:self\n selector:@selector(keyboardWasHidden:)\n name:UIKeyboardDidHideNotification object:nil];\n}\n\n\/\/ Called when the UIKeyboardDidShowNotification is sent.\n- (void)keyboardWasShown:(NSNotification*)aNotification{\nif (bKeyboardShownM)\nreturn;\n\t\nNSDictionary* info = [aNotification userInfo];\n\n\/\/ Get the size of the keyboard.\nNSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];\nCGSize keyboardSize = [aValue CGRectValue].size;\n\t\n\/\/ Resize the scroll view (which is the root view of the window)\nCGRect viewFrame = [self.svScrollViewM frame];\nviewFrame.size.height -= keyboardSize.height;\nself.svScrollViewM.frame = viewFrame;\n\t\n\/\/ Scroll the active text field into view.\nCGRect textFieldRect = [self.ctrlKeyboardFocusFieldM frame];\n[self.svScrollViewM scrollRectToVisible:textFieldRect animated:YES];\nbKeyboardShownM = YES;\n}\n\n\/\/ Called when the UIKeyboardDidHideNotification is sent\n- (void)keyboardWasHidden:(NSNotification*)aNotification{\nNSDictionary* info = [aNotification userInfo];\n\t\t\n\/\/ Get the size of the keyboard.\nNSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey];\nCGSize keyboardSize = [aValue CGRectValue].size;\n\n\/\/ Reset the height of the scroll view to its original value\nCGRect viewFrame = [self.svScrollViewM frame];\nviewFrame.size.height += keyboardSize.height;\nself.svScrollViewM.frame = viewFrame;\nbKeyboardShownM = NO;\n}\n\n- (void)textFieldDidBeginEditing:(UITextField *)textField{\nself.ctrlKeyboardFocusFieldM = textField;\n}\n\n- (void)textFieldDidEndEditing:(UITextField *)textField{\nself.ctrlKeyboardFocusFieldM = nil;\n}\n\n- (void) registerForEditingEvents:(UIControl*)aControl{\n[aControl addTarget:self action:@selector(textFieldDidBeginEditing:) \nforControlEvents:UIControlEventEditingDidBegin];\n[aControl addTarget:self action:@selector(textFieldDidEndEditing:) \n\t\t\t\tforControlEvents:UIControlEventEditingDidEnd];\n}\t \n@end\n[\/objc]<\/pre>\n<p>1.registerForKeyboardNotifications function is used to set notifications whenever keyboard is shown or hidden, and it accordingly, calls selector methods keyboardWasShown or keyboardWasHidden respectively.<br>2.In keyboardWasShown function, we obtain the keyboard frame size, and resize it from the scroll view&#8217;s frame size (which is equivalent to shifting the scroll upwards).Accordingly, we also move the active text field to a location above the keyboard so as to make it visible.<br>3.In keyboardWasHidden function, we add the keyboard size to the current frame size, to obtain the original size, and it also move the active textfield to its original position.<\/p>\n<h5><b>MIScrollView.h &#8211;<\/b><\/h5>\n<pre>[objc]\n#import \n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;MIBackgroundTapDelegate.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n\t\t\n@interface MIScrollView : UIScrollView {\nid backgroundTapDelegate;\n}\n\n@property (nonatomic, retain) idbackgroundTapDelegate;\n@end\n[\/objc]<\/pre>\n<h5><b>MIScrollView.m &#8211;<\/b><\/h5>\n<pre>[objc]\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;MIScrollView.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n#import &amp;amp;amp;amp;amp;amp;amp;amp;quot;MIBackgroundTapDelegate.h&amp;amp;amp;amp;amp;amp;amp;amp;quot;\n\n@implementation MIScrollView\n@synthesize backgroundTapDelegate;\n\n-(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event {\nif(backgroundTapDelegate) {\n[backgroundTapDelegate backgroundTap: self];\n}\n}\n@end\n[\/objc]<\/pre>\n<p>In the BackgroundTapForBlogViewController.xib, add a scrollview, move everything on top of the scrollview and resize it as per requirement. In its Identity Inspector(Command+4), change its class to MIScrollView.<br>Link this scrollview to svScrollViewM of File&#8217;s Owner.<br><\/p><h5><strong>Linking scrollview<\/strong><\/h5><br><a href=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41.png\"><noscript><img decoding=\"async\" class=\"size-medium wp-image-333\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41-300x164.png\" alt width=\"400\" height=\"220\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41-300x164.png 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41.png 915w\" sizes=\"(max-width: 400px) 100vw, 400px\"><\/noscript><img decoding=\"async\" class=\"size-medium wp-image-333 lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E\" alt width=\"400\" height=\"220\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E 400w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41-300x164.png 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41.png 915w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-41-300x164.png\"><\/a>\n<p>Link delegate and backgroundTapDelegate of MIScrollView to File&#8217;s Owner.<br><\/p><h5>\n<strong>Linking Delegates of scrollview<\/strong><\/h5><br><a href=\"\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3.png\"><noscript><img decoding=\"async\" class=\"size-medium wp-image-332\" src=\"\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3-300x165.png\" alt width=\"400\" height=\"220\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3-300x165.png 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3.png 916w\" sizes=\"(max-width: 400px) 100vw, 400px\"><\/noscript><img decoding=\"async\" class=\"size-medium wp-image-332 lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E\" alt width=\"400\" height=\"220\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20400%20220%22%3E%3C%2Fsvg%3E 400w\" sizes=\"(max-width: 400px) 100vw, 400px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3-300x165.png 300w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3.png 916w\" data-src=\"\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-3-300x165.png\"><\/a>\n<p>Now, save your application in Xcode, and press Build &amp; Go. When you select the textfield, the output would look like this &#8211;<br><\/p><h5><strong>Frame resized<\/strong><\/h5><br><a href=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44.png\"><noscript><img decoding=\"async\" class=\"size-medium wp-image-334\" src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44-161x300.png\" alt width=\"161\" height=\"300\" srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44-161x300.png 161w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44.png 414w\" sizes=\"(max-width: 161px) 100vw, 161px\"><\/noscript><img decoding=\"async\" class=\"size-medium wp-image-334 lazyload\" src=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20161%20300%22%3E%3C%2Fsvg%3E\" alt width=\"161\" height=\"300\" srcset=\"data:image\/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20161%20300%22%3E%3C%2Fsvg%3E 161w\" sizes=\"(max-width: 161px) 100vw, 161px\" data-srcset=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44-161x300.png 161w, https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44.png 414w\" data-src=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-9-17-49-44-161x300.png\"><\/a>\n<p>You can download the source code from <a href=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/BackgroundTapForBlog.zip\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is written to provide you with the process to get the return button working on the keypad that pops up while filling a text field, the \u201cBackground Tap\u201d functionality, and also what to do when the text field hides behind the keypad. First we make a demo View-based Application for this, say \u201cBackgroundTapForBlog\u201d [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"yes","footnotes":""},"categories":[3],"tags":[328,62,61,60],"class_list":["post-4105","post","type-post","status-publish","format-standard","hentry","category-iphone","tag-iphone-ipad","tag-keyboard-handling","tag-tutorial","tag-uitextfield"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>iPhone UITextField Tutorial: Handling Keyboard Interactions - Mobisoft Infotech<\/title>\n<meta name=\"description\" content=\"iPhone UITextField Tutorial: Handling Keyboard Interactions -this tutorial provides you with the process to get the return button working on the keypad\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"iPhone UITextField Tutorial: Handling Keyboard Interactions - Mobisoft Infotech\" \/>\n<meta property=\"og:description\" content=\"iPhone UITextField Tutorial: Handling Keyboard Interactions -this tutorial provides you with the process to get the return button working on the keypad\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\" \/>\n<meta property=\"og:site_name\" content=\"Mobisoft Infotech\" \/>\n<meta property=\"article:published_time\" content=\"2010-02-17T10:11:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-22T06:14:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png\" \/>\n\t<meta property=\"og:image:width\" content=\"922\" \/>\n\t<meta property=\"og:image:height\" content=\"504\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ashish Khadse\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ashish Khadse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#article\",\"isPartOf\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\"},\"author\":{\"name\":\"Ashish Khadse\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/ed791f604c076422fdd562c663b1e74b\"},\"headline\":\"iPhone UITextField Tutorial: Handling Keyboard Interactions\",\"datePublished\":\"2010-02-17T10:11:32+00:00\",\"dateModified\":\"2024-11-22T06:14:29+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\"},\"wordCount\":650,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22-300x163.png\",\"keywords\":[\"iPhone \u2013 iPad\",\"Keyboard Handling\",\"Tutorial\",\"UITextField\"],\"articleSection\":[\"iPhone - iPad\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\",\"name\":\"iPhone UITextField Tutorial: Handling Keyboard Interactions - Mobisoft Infotech\",\"isPartOf\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage\"},\"image\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage\"},\"thumbnailUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22-300x163.png\",\"datePublished\":\"2010-02-17T10:11:32+00:00\",\"dateModified\":\"2024-11-22T06:14:29+00:00\",\"author\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/ed791f604c076422fdd562c663b1e74b\"},\"description\":\"iPhone UITextField Tutorial: Handling Keyboard Interactions -this tutorial provides you with the process to get the return button working on the keypad\",\"breadcrumb\":{\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png\",\"contentUrl\":\"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png\",\"width\":922,\"height\":504,\"caption\":\"Linking textFieldDoneEditing\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mobisoftinfotech.com\/resources\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"iPhone UITextField Tutorial: Handling Keyboard Interactions\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#website\",\"url\":\"https:\/\/mobisoftinfotech.com\/resources\/\",\"name\":\"Mobisoft Infotech\",\"description\":\"Discover Mobility\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mobisoftinfotech.com\/resources\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/ed791f604c076422fdd562c663b1e74b\",\"name\":\"Ashish Khadse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/1e9a570aa46e2b6152a8d84fa2ccd735358b573932797e5d0eacbb1995b6369c?s=96&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1e9a570aa46e2b6152a8d84fa2ccd735358b573932797e5d0eacbb1995b6369c?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1e9a570aa46e2b6152a8d84fa2ccd735358b573932797e5d0eacbb1995b6369c?s=96&r=g\",\"caption\":\"Ashish Khadse\"},\"sameAs\":[\"http:\/\/www.mobisoftinfotech.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"iPhone UITextField Tutorial: Handling Keyboard Interactions - Mobisoft Infotech","description":"iPhone UITextField Tutorial: Handling Keyboard Interactions -this tutorial provides you with the process to get the return button working on the keypad","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions","og_locale":"en_US","og_type":"article","og_title":"iPhone UITextField Tutorial: Handling Keyboard Interactions - Mobisoft Infotech","og_description":"iPhone UITextField Tutorial: Handling Keyboard Interactions -this tutorial provides you with the process to get the return button working on the keypad","og_url":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions","og_site_name":"Mobisoft Infotech","article_published_time":"2010-02-17T10:11:32+00:00","article_modified_time":"2024-11-22T06:14:29+00:00","og_image":[{"width":922,"height":504,"url":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png","type":"image\/png"}],"author":"Ashish Khadse","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ashish Khadse","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#article","isPartOf":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions"},"author":{"name":"Ashish Khadse","@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/ed791f604c076422fdd562c663b1e74b"},"headline":"iPhone UITextField Tutorial: Handling Keyboard Interactions","datePublished":"2010-02-17T10:11:32+00:00","dateModified":"2024-11-22T06:14:29+00:00","mainEntityOfPage":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions"},"wordCount":650,"commentCount":0,"image":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage"},"thumbnailUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22-300x163.png","keywords":["iPhone \u2013 iPad","Keyboard Handling","Tutorial","UITextField"],"articleSection":["iPhone - iPad"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions","url":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions","name":"iPhone UITextField Tutorial: Handling Keyboard Interactions - Mobisoft Infotech","isPartOf":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/#website"},"primaryImageOfPage":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage"},"image":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage"},"thumbnailUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22-300x163.png","datePublished":"2010-02-17T10:11:32+00:00","dateModified":"2024-11-22T06:14:29+00:00","author":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/ed791f604c076422fdd562c663b1e74b"},"description":"iPhone UITextField Tutorial: Handling Keyboard Interactions -this tutorial provides you with the process to get the return button working on the keypad","breadcrumb":{"@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#primaryimage","url":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png","contentUrl":"https:\/\/mobisoftinfotech.com\/resources\/wp-content\/uploads\/2010\/02\/Picture-22.png","width":922,"height":504,"caption":"Linking textFieldDoneEditing"},{"@type":"BreadcrumbList","@id":"https:\/\/mobisoftinfotech.com\/resources\/blog\/iphone\/iphone-uitextfield-tutorial-handling-keyboard-interactions#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mobisoftinfotech.com\/resources\/"},{"@type":"ListItem","position":2,"name":"iPhone UITextField Tutorial: Handling Keyboard Interactions"}]},{"@type":"WebSite","@id":"https:\/\/mobisoftinfotech.com\/resources\/#website","url":"https:\/\/mobisoftinfotech.com\/resources\/","name":"Mobisoft Infotech","description":"Discover Mobility","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mobisoftinfotech.com\/resources\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/mobisoftinfotech.com\/resources\/#\/schema\/person\/ed791f604c076422fdd562c663b1e74b","name":"Ashish Khadse","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/1e9a570aa46e2b6152a8d84fa2ccd735358b573932797e5d0eacbb1995b6369c?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/1e9a570aa46e2b6152a8d84fa2ccd735358b573932797e5d0eacbb1995b6369c?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1e9a570aa46e2b6152a8d84fa2ccd735358b573932797e5d0eacbb1995b6369c?s=96&r=g","caption":"Ashish Khadse"},"sameAs":["http:\/\/www.mobisoftinfotech.com"]}]}},"_links":{"self":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/4105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/comments?post=4105"}],"version-history":[{"count":20,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/4105\/revisions"}],"predecessor-version":[{"id":32246,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/posts\/4105\/revisions\/32246"}],"wp:attachment":[{"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/media?parent=4105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/categories?post=4105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mobisoftinfotech.com\/resources\/wp-json\/wp\/v2\/tags?post=4105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}