[英]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.