UKeyboard"闪烁"在辞职第一响应者状态时

时间:2014-03-23 14:32:46

标签: ios objective-c

这可能是ios7问题,因为我之前没有注意到它。我有一个UITextField,其外观设置如下:

namingTextField.keyboardAppearance = UIKeyboardAppearanceDark;

当用户完成编辑后,我这样做:

//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;        
                }
            }];
        }
    }];

当UIKeyboard退出时,它会闪烁到光线外观。我使用UIKeyboardAppearanceLight尝试了它,它根本没有闪烁。我也尝试将它移出动画块,但没有任何区别。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

有时在其他事情发生时重新调整键盘会导致很多UI故障,一种方法是执行@selector延迟0而不是直接调用{{1 }}。奇怪的是,这可行但我已经解决了许多奇怪的键盘动画问题。例如:

resignFirstResponder

当然,在[self performSelector:@selector(hideKeyboard) withObject:nil afterDelay:0]; ,您只需致电:

hideKeyboard

如果有帮助,请告诉我。