IOS 关闭键盘/退出键盘

2020-04-24  本文已影响0人  清风_____

1.方法 一

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [myTextView resignFirstResponder];
}

2.方法二

第一响应存在于self.view

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}
上一篇下一篇

猜你喜欢

热点阅读