iOS收起键盘的几种方法

  1. [self.textField resignFirstResponder];

  2. [self.view endEditing:YES];

  3. //适用于 获得当前UIViewController比较困难的时候用
    [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];

  4. [[[UIApplication sharedApplication]keyWindow]endEditing:YES];

你可能感兴趣的:(iOS收起键盘的几种方法)