키보드가 표시 될 때 크기가 조정되는 UIScrollView가 있습니다 (맨 아래부터 밀어 넣을 때 키보드 위에 있어야합니다). 애니메이션을 올바르게 작동 시키려면 UIAnimationOptionBeginFromCurrentState를 지정해야합니다. 이것을 지정하지 않으면 애니메이션 중에 이상한 효과가 발생하고 UIScrollView를 들여다 볼 수 있습니다. 여기에 애니메이션 루틴입니다 :uiscrollview 질감이있는 배경이 프레임 애니메이션 후에 압축됩니다.
- (void) onKeyboardWillShow: (NSNotification*) n
{
// get the keyboard rect
CGRect rKeyboard; NSValue* v;
v = [n.userInfo objectForKey: UIKeyboardFrameEndUserInfoKey];
[v getValue: &rKeyboard];
rKeyboard = [self.view convertRect: rKeyboard fromView: nil];
// get the keyboard animation duration, animation curve
v = [n.userInfo objectForKey: UIKeyboardAnimationDurationUserInfoKey];
double keyboardAnimationDuration;
[v getValue: &keyboardAnimationDuration];
v = [n.userInfo objectForKey: UIKeyboardAnimationCurveUserInfoKey];
UIViewAnimationCurve keyboardAnimationCurve;
[v getValue: &keyboardAnimationCurve];
// animate
[UIView animateWithDuration: keyboardAnimationDuration
delay: 0
options: UIViewAnimationOptionBeginFromCurrentState | keyboardAnimationCurve
animations: ^{
CGRect f = _clientAreaView.frame;
f.size.height = rKeyboard.origin.y - f.origin.y;
_clientAreaView.frame = f;
}
completion: ^(BOOL finished) {
}];
}
문제는 scrollViewTexturedBackgroundColor로 설정되어있는 UIScrollView의 backgroundColor입니다. 애니메이션 후에 질감이있는 배경이 압축됩니다 (작은 아티팩트가 표시됨). 다시 원래 크기로 되돌립니다. 정상으로 돌아갑니다.
배경을 애니메이션과 함께 크기를 조정하지 않거나 적어도 비 압축 모양의 포스트 애니메이션으로 배경 '팝'을 만들려면 어떻게해야합니까? 완료 루틴에서 bg 색상을 설정하려고했는데 (흰색으로 돌아온 다음 scrollViewTexturedBackgroundColor로 돌아가지만 작동하지 않아 실제로 이유를 알지 못합니다.)
UIAnimationCurve의 캐치를 주셔서 감사합니다. 난 분명히 해당 UIAnimationOption에 매핑해야 ... – TomSwift