UITextField not getting keyboard input

后端 未结 4 717
我在风中等你
我在风中等你 2020-12-09 05:51

I\'m having troubles entering text into an UITextField under a SVProgressHUD (Basically an UIView with a full-screen transparent UIWindow and some UIView subviews showing te

相关标签:
4条回答
  • 2020-12-09 06:17

    I finally found the problem: SVProgressHUD calls makeKeyAndVisible when it's initialized, because it wants to receive keyboard notifications for repositioning. I looked up what the "Key Window" actually is and found out:

    ...The key window responds to user input...

    Now, as the UIWindow of the SVProgressHUD was the keyWindow, my other window, which contained the UITextField did not get the user input.

    I finally call makeKeyWindow on the AppDelegate's window and everything is working fine.

    I hope this helps anyone with similar problems.

    0 讨论(0)
  • 2020-12-09 06:27

    Have you implemented the method....

    - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
    

    ...to filter out any unwanted characters? If so, perhaps it's being a little overzealous with the filtering?

    0 讨论(0)
  • 2020-12-09 06:31

    Call resignFirstResponder() to dismiss the keyboard before showing SVProgressHUD.

    0 讨论(0)
  • 2020-12-09 06:43

    For me this is worked.

    I did changes in my textfield delegate method then it worked.

    if ([textField isEqual:selectBankName])
    {
       return No;
    }
    else if ([textField isEqual:enterAmountTextfield])
    {
        return YES;
    }
    
    return NO;
    }
    
    1. set delegate for textfield
    2. Make sure textfield userInteraction is Enabled.And

    3. Finally Please check your textfield delegate method.

    0 讨论(0)
提交回复
热议问题