开发者

How to open the view with the keyboard appearing when the view is already loaded?

I have a requirement where I have a textfield in a view. When I want to open t开发者_运维知识库he view by switching the tab (TabBased Application), first time when the view is loaded the keyboard appears because i loadview method is called. But when I switch to tab2 and again switch to tab1 again, load view is not called. I want the keyboard to appear every time I open the tab1 page.


Use -viewWillAppear: in your view controller to send your text field a -becomeFirstResponder message, e.g.:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜