1

以下是我正在编写的代码

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)#>]

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

4

1 回答 1

1

将委托设置UITextField为自己

category.delegate = self;

确保创建UITextField实现的类UITextFieldDelegate

于 2012-08-14T18:13:13.970 回答