mamcx
mamcx

Reputation: 16196

How get the list of controls on a view with iPhone SDK?

I wanna do something like the safari app when fill a form, so when the user see the keyboard do next and move to next control.

Now, how I get the next text control?

Upvotes: 1

Views: 2315

Answers (2)

August
August

Reputation: 12177

You'll have to roll your own by adding a subview with your own next/previous buttons and positioning it at the top edge of the keyboard.

Upvotes: 1

Ryan Townshend
Ryan Townshend

Reputation: 2394

You can handle behaviour like this in textFieldShouldReturn: This should move your focus along the form for you each time the user hits return.

- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    if(textField == field1) {
        [field1 resignFirstResponder];   
        [field2 becomeFirstResponder];    
        // do stuff with field1 text
    } else if(textField == field2) {
        [field2 resignFirstResponder];   
        [field3 becomeFirstResponder];
        // do stuff with field2 text
    } // and so on

}

Upvotes: 4

Related Questions