天天看點

IOS 點選空白處隐藏鍵盤的幾種方法

第一種: 使用view的touchesBegan:觸摸事件來實作對鍵盤的隐藏,當點選view的區域就會觸發這個事件

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{

    [searchBar resignFirstResponder];

}