I want that my textfield must be focused when i open the login page in iPhone. Please help开发者_运维百科.
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[textfield becomeFirstResponder];
}
In your viewDidLoad function for that page, call setFirstResponder on your textfield, that should do it.
simply take an outlet for the textfeild and write a line like [textfeildstate becomesfirstResponder]; whenever the view launches..
Just write code in viewwillAppear [textField becomeFirstResponder] and you work is done ..
For all those who are still searching. Use
[textfield becomeFirstResponder]
精彩评论