removing keyboard from Screen without calling resignFirstResponder

后端 未结 4 1279
青春惊慌失措
青春惊慌失措 2021-01-18 01:57

I have a custom View (NotifyView) added on UIWindow with a dismiss button(which remove it from UIWindow). This view is added when a PU

相关标签:
4条回答
  • 2021-01-18 02:28

    The problem it is, when you want to give back the focus.

    I have implemented as listening each textfield and caching which is the latest. Than resign only that one ( in push ) after that restore state, require focus for that.

    0 讨论(0)
  • 2021-01-18 02:40

    You can use the method below

    [[[UIApplication sharedApplication] keyWindow] endEditing:YES]
    
    0 讨论(0)
  • 2021-01-18 02:42

    Try this one , for me it works fine [yourView endEditing:YES]

    0 讨论(0)
  • 2021-01-18 02:48

    Try this in delegate method...

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
      [self.view endEditing:YES]; // added this in for case when keyboard was already on screen
      [self editStartDate:textField];
      return NO;
    }
    
    0 讨论(0)
提交回复
热议问题