1、大致搭建UI:
2、键盘
(1)点击空白处退下键盘
@property (weak, nonatomic) IBOutlet UITextField *lowPrice;
@property (weak, nonatomic) IBOutlet UITextField *highPrice;
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[_lowPrice resignFirstResponder];
[_highPrice resignFirstResponder];
}
(2)右上角添加”确定”按钮
这里关键就是给textField添加inputAccessoryView
// 创建“完成”按钮
UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake([UIScreen mainScreen].bounds.size.width - 90, 7, 80, 30)];
button