以下是我正在编写的代码
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控件事件?
答案 0 :(得分:1)
将UITextField
的委托设置为自己
category.delegate = self;
确保创建UITextField
的类实现UITextFieldDelegate