简体   繁体   English

退出急救人员状态时,UKeyboard“闪烁”

[英]UKeyboard “flickers” when resigning first responder status

This may be an ios7 issue as I have not noticed it before. 这可能是ios7问题,因为我之前没有注意到。 I have a UITextField, and its appearance is set like so: 我有一个UITextField,其外观设置如下:

namingTextField.keyboardAppearance = UIKeyboardAppearanceDark;

When the user is done editing, I do this: 当用户完成编辑后,我将执行以下操作:

//Animate inputView out of the way
    [UIView animateWithDuration:kAnimationTime delay:0.0f options:UIViewAnimationOptionCurveEaseIn animations:^{


        //Resign first responder
        [namingTextField resignFirstResponder];

        //Animate GUI out
        inputBckGrnd.frame = CGRectMake(-self.view.frame.size.width, inputBckGrnd.frame.origin.y, inputBckGrnd.frame.size.width, inputBckGrnd.frame.size.height);
        inputLbl.frame = CGRectMake(-self.view.frame.size.width, inputLbl.frame.origin.y, inputLbl.frame.size.width, inputLbl.frame.size.height);

    }completion:^(BOOL finished){
        if(finished){
            [UIView animateWithDuration:kAnimationTime delay:0.0f options:UIViewAnimationOptionCurveEaseOut animations:^{
                self.inputViewDimmer.alpha = 0.0f;
                self.inputBlur.alpha = 0.0f;
            }completion:^(BOOL finished){
                if(finished){
                    //Input UI knocked out
                    didLoadInputUI = NO;

                    //Kill GUI
                    [inputBckGrnd removeFromSuperview];
                    [inputLbl removeFromSuperview];

                    inputBckGrnd = nil;
                    inputLbl = nil;        
                }
            }];
        }
    }];

When the UIKeyboard resigns, it flickers to the light appearance. 当UIKeyboard退出时,它会闪烁以显示外观。 I tried it with using UIKeyboardAppearanceLight and it doesn't flicker at all. 我使用UIKeyboardAppearanceLight进行了UIKeyboardAppearanceLight ,它根本不会闪烁。 I also tried moving it out of the animation block but it made no difference. 我也尝试将其移出动画块,但没有任何区别。

Any ideas? 有任何想法吗?

Sometimes resigning the keyboard when other things are going on can cause lots of UI glitches, one way around this is to perform a @selector with a delay of 0 instead of just outright calling resignFirstResponder . 有时在发生其他事情时对键盘进行重新设计会导致很多UI故障,一种解决方法是执行延迟为0@selector ,而不是直接调用resignFirstResponder It's strange that this works but I've had it solve many strange keyboard animation issues for me before. 奇怪的是,这行得通,但是我之前已经为我解决了许多奇怪的键盘动画问题。 Example: 例:

[self performSelector:@selector(hideKeyboard) withObject:nil afterDelay:0];

Of course, in hideKeyboard you would just call: 当然,在hideKeyboard您只需调用:

[namingTextField resignFirstResponder];

Let me know if this helps. 让我知道是否有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 自定义 inputaccessoryView 中的 UITextView 未退出第一响应者状态 - UITextView in custom inputaccessoryView not resigning first responder status UITextField不辞职第一响应者? - UITextField not resigning first responder? EarlGrey失败-“键盘在退出第一响应者状态后没有消失” - EarlGrey Failure - “Keyboard did not disappear after resigning first responder status” 为多个 UITextFields 辞职第一响应者 - Resigning First Responder for multiple UITextFields UITextField,在辞退第一响应者时,导致奇怪的文本动画滚动 - UITextField, when resigning first responder, causing strange animation scroll of text 辞去UITextField的第一个响应者时,NSParagraphStyle发生了变化 - NSParagraphStyle is changed when resigning UITextField's first responder 将文本视图退出为第一响应者,并在按下回车键时将文本字段设为第一响应者 - Resigning a text view as first responder and making a text field first responder when pressing return 快速从第一响应者辞职TextView - Swift resigning TextView from first responder iOS文本字段未退出第一响应者 - iOS text field not resigning first responder 在文本字段中分配和辞退第一响应者 - Assigning and Resigning first responder in text field
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM