修改视图控制器的view属性,将它的底层类由UIView更改为UIControl

添加一个Action,Action是Touch Down

 

- (IBAction)backgroudTap:(id)sender {

    [myTextField resignFirstResponder];

}

记住你的UITextField的Outlet一定要是weak的属性(一般的Outlet都是weak的),不然会出错

-[UITextInputTraits resignFirstResponder]: unrecognized selector sent to instance

相关文章:

  • 2022-12-23
  • 2021-06-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-18
  • 2021-09-03
  • 2021-10-23
  • 2022-01-09
猜你喜欢
  • 2021-09-27
  • 2021-07-06
  • 2021-06-28
  • 2021-05-31
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
相关资源
相似解决方案