UITableViewCell Resign FirstResponder


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 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
链接地址: http://www.djcxy.com/p/44304.html

上一篇: UITableViewCell中的UITextField将不接受becomeFirstResponder

下一篇: UITableViewCell辞职FirstResponder