![](/img/trans.png)
[英]UITextView in custom inputaccessoryView not resigning first responder status
[英]UKeyboard “flickers” when resigning first responder status
这可能是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
进行了UIKeyboardAppearanceLight
,它根本不会闪烁。 我也尝试将其移出动画块,但没有任何区别。
有任何想法吗?
有时在发生其他事情时对键盘进行重新设计会导致很多UI故障,一种解决方法是执行延迟为0
的@selector
,而不是直接调用resignFirstResponder
。 奇怪的是,这行得通,但是我之前已经为我解决了许多奇怪的键盘动画问题。 例:
[self performSelector:@selector(hideKeyboard) withObject:nil afterDelay:0];
当然,在hideKeyboard
您只需调用:
[namingTextField resignFirstResponder];
让我知道是否有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.