03Find Next Tag Manage Keyboard

suggest change

The text field calls different delegate methods (only if delegates are set)One of delegate method called by textfield is *- (BOOL)textFieldShouldReturn:(UITextField )textField

This method is called whenever users taps the return button.By using this method, we can implement any custom behaviour.

For Example,

In the below example ,next responder will be find out on the basis of tag and manage the keyboard. Here 20 is the constant,As tag assigned to textfield are like this 50,70,90 etc.

Here on finding a new textfield object as responder,it will make current text field as new responder and open keyboard accordingly.

- (BOOL)textFieldShouldReturn:(UITextField *)textField {

               NSInteger nextTag = textField.tag+20;
               // Try to find next responder
               UIResponder *nextResponder = [textField.superview viewWithTag:nextTag];
               if (nextResponder)
               {
                   // Found next responder, so set it.
                   [nextResponder becomeFirstResponder];
               }
               else
               {
                   // Not found, so remove keyboard.
                   [textField resignFirstResponder];
               }
               return YES;
           }

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


UITextField Delegate:
* 03Find Next Tag Manage Keyboard

Table Of Contents
12 UIView
15 UIColor
26 UIImage
28 CALayer
30 NSDate
40 iBeacon
49 NSTimer
79 NSURL
87 AWS SDK
96 NSData
101 Segues
104 EventKit
105 NSBundle
106 SiriKit
111 StoreKit
117 3D Touch
119 Keychain
122 Block
126 UITextField Delegate
141 AirDrop
144 UISlider
145 Carthage
146 HealthKit
151 plist
157 MVVM
164 UIPhoenix
166 Simulator
168 NSArray
169 OpenGL
175 Core Data
179 MyLayout
180 UIFont
189 Security
200 Codable