Suresh Varma
Suresh Varma

Reputation: 9740

textfield selected by default-iphone

I want that my textfield must be focused when i open the login page in iPhone. Please help.

Upvotes: 4

Views: 354

Answers (5)

Suresh Varma
Suresh Varma

Reputation: 9740

For all those who are still searching. Use

    [textfield becomeFirstResponder]

Upvotes: 1

mrugen munshi
mrugen munshi

Reputation: 3607

Just write code in viewwillAppear [textField becomeFirstResponder] and you work is done ..

Upvotes: 1

ajay
ajay

Reputation: 3345

simply take an outlet for the textfeild and write a line like [textfeildstate becomesfirstResponder]; whenever the view launches..

Upvotes: 1

Dan F
Dan F

Reputation: 17732

In your viewDidLoad function for that page, call setFirstResponder on your textfield, that should do it.

Upvotes: 1

Daniel Dickison
Daniel Dickison

Reputation: 21882

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [textfield becomeFirstResponder];
}

Upvotes: 1

Related Questions