textField代理方法

//textField代理方法
// 返回no 不能输入文字
- (BOOL)textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString*)string

// 进入编辑模式
- (void)textFieldDidBeginEditing:(UITextField*)textField

// 设置中文(locale属性)
datePicker.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];

// 添加一个监听 来监听datepicker的日期选择
[datePicker addTarget:self action:@selector(didSelectDate:) forControlEvents:UIControlEventValueChanged];

// 设置显示格式
datePicker.datePickerMode = UIDatePickerModeDate;

// textField自定义键盘视图
textField.inputView
// textField辅助视图
textField.inputAccessoryView

toolbar 只能放 barbuttonitem

原文地址:https://www.cnblogs.com/AgentLXJ/p/5063745.html