在我的应用程序中,我有一个 UITextField,它在 UITableViewController 中实例化如下:
doField = [[UITextField alloc] initWithFrame: doFieldRect];
doField.delegate = self;
然后我使用
将其添加到我的 View 中[self.view addSubview: doField];
如何让这个 subview 响应 UITableViewController 中的委托(delegate)方法?因为它没有响应任何方法...
最佳答案
在头文件中,您需要添加委托(delegate):
@interface MyClassHeaderFile : UITableViewController <UITextFieldDelegate>
关于iphone - 如何让 UITextField 响应 UITextFieldDelegate?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9518565/