您的位置:首页 > 其它

Iphone SDK textField 打开和关闭键盘

2010-06-13 16:55 423 查看
1.打开键盘,当打开某个View,希望打开键盘的时候,在ViewDidLoad的方法中插入如下代码
[myTextFieldbecomeFirstResponder];

2.当需要关闭键盘的时候,在关键键盘的事件中,如button写下如下的代码

[myTextFieldresignFirstResponder];

轻触背景隐藏软键盘

(IBAction)View_TouchDown:(id)sender{

//发送resignFirstResponder.

[[UIApplicationsharedApplication]sendAction:@selector(resignFirstResponder)to:nilfrom:nilforEvent:nil];

}



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: