开发者

Hide keyboard when touch uitableview

I h开发者_高级运维ave a custom cell with a uitextfield inside. I want to hide the keyboard when the user touch the screen, I put a custom uibutton over my tableView, and in the touch up inside event, I call

-(IBAction) hideKeyBoard
{
    [customcell.textfield resignFirstResponder];
}

is it the right way to hide the keyboard with a uitableview because it don't works


No, a UIButton over your tableview is going to obstruct touches to the table, and views with alpha less than something like 0.1.

One method would be to subclass UITableView and override touchesBegan to detect a touch. From there, you have many options for how to deal with resigning first responder, notification, delegate method, reference to the text field.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜