I have a grouped table view that contains 3 sections and each row in each section. The first two lines of sections contain a UITextField (Name and Subject are the names of sections), and the last contains a UITextView (Message is the section title), because I want to receive some data from the user by this controller.
Two text fields have returnKeyType as UIReturnKeyNext. For UITextView, a return button is present on the keyboard to feed a new line. Therefore, I used the textFieldShouldReturn method to go to the next cell by pressing these return type buttons in UIKeyboard.
The next button will work fine with the first text box (Name). Here the problem arises ... If I click the "Next" button of the second cell, it will go to the UITextView (last cell) with one row down. That is, the cursor moves one line separately from the starting position.
My code ...
-(BOOL) textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; if (textField == nameTextField) { [subjectTextField becomeFirstResponder]; } else if(textField == subjectTextField) { [messageTextView becomeFirstResponder]; } return YES; }
What should I do to make this work beautiful? Thanks at Advance ..
source share