Ios5 如何为以编程方式创建的textfield启动TextFieldDiEndediting函数

Ios5 如何为以编程方式创建的textfield启动TextFieldDiEndediting函数,ios5,uitextfield,keyboard-events,Ios5,Uitextfield,Keyboard Events,下面是我正在编写的代码 UITextField *category =[[UITextField alloc] initWithFrame:CGRectMake(10, 90, subView.frame.size.width-15, 30)]; category.backgroundColor=[UIColor whiteColor]; category.placeholder = @"Category, Description, Model (optional)"; category.ret

下面是我正在编写的代码

UITextField *category =[[UITextField alloc] initWithFrame:CGRectMake(10, 90, subView.frame.size.width-15, 30)];
category.backgroundColor=[UIColor whiteColor];
category.placeholder = @"Category, Description, Model (optional)";
category.returnKeyType = UIReturnKeyNext;
// [category addTarget:self action:@selector(textFeild) forControlEvents:<#(UIControlEvents)#>]
UITextField*category=[[UITextField alloc]initWithFrame:CGRectMake(10,90,subView.frame.size.width-15,30)];
类别.backgroundColor=[UIColor whiteColor];
category.placeholder=@“类别、说明、模型(可选)”;
category.returnKeyType=UIReturnKeyNext;
//[category addTarget:self action:@selector(textfield)forControlEvents:]

语句应该是什么,以便我可以添加TextFielddEndediting控件事件?

UITextField
的委托设置为self

category.delegate = self;

确保创建
UITextField
的类实现了
UITextFieldDelegate
UITextField
的委托设置为self

category.delegate = self;

确保创建
UITextField
的类实现了
UITextFieldDelegate

不起作用,我不知道是什么问题。这甚至不会触发键盘将隐藏通知尝试将returnkeytype更改为Done或return或DefaultDoesNot,我不知道是什么错。这甚至不会触发键盘将隐藏通知尝试将returnkeytype更改为Done或return或default