开发者

UITableViewCell Resign FirstResponder

开发者 https://www.devze.com 2023-01-10 23:48 出处:网络
Hi, I have a UIViewController class that contains a UITableViewCell subclass. Within the tableViewCell I have a UITextView that calls the numberPad which I have ammended to contain the missing DON

Hi,

I have a UIViewController class that contains a UITableViewCell subclass.

Within the tableViewCell I have a UITextView that calls the numberPad which I have ammended to contain the missing DONE button.

THe DONE button, when pressed calls a method named backgroundPressed. This method is called from the root UIViewController class.

-(IBAction)backgroundPressed:(id)sender{

[textField2 resignFirstResponder];

The problem I have is that calling this method does not dismiss the numberPad. This is probably because the method is called from the开发者_如何学Go UIViewContoller class. How do I access the UITableViewCell to resign the first responder when the for the UITextView?

Many Thanks


This should work. Does textField2 have a valid reference to the textField? I presume that your UITableViewCell is a custom object are you saving a reference to either the cell object or the textfield?

[myCellObject.textField2 resignFirstResponder]
// or
[self.textField2 resignFirstResponder]    // should work if you have a valid reference
0

精彩评论

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

关注公众号