![](/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.