iphone - 如何让 UITextField 响应 UITextFieldDelegate?

标签 iphone objective-c ios cocoa-touch

在我的应用程序中,我有一个 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/

相关文章:

iphone - 有没有办法从 iPhone 上的标准输入读取,无论是硬件还是模拟器?

iphone - HTML5 和移动网站开发

iphone - iOS:UITableView 说明

ios - 当我回来时,TableView 显示相同的数据两次或更多次?

iphone - 根据设备方向旋转图像

iphone - 如果我的构建目标是 iOS 5.0,当较旧的操作系统版本尝试下载/运行它时会发生什么情况?

iphone - 将值附加到 NSMutableArray 并保存到 NSUserDefaults

ios - Alamofire:在展开可选值时意外发现 nil

iphone - 从 iPod 库获取播放列表 - Objective C

ios - 检查有多少用户在他们的设备上启动我的苹果应用程序?