0
I는 버튼 보여주는 키보드에 응답하여 다른 뷰를 이동 애니메이션 코드를 가지고UIAlertView 블록 기반 애니메이션
NSValue *frameValue = [note userInfo][UIKeyboardFrameEndUserInfoKey];
CGRect keyboardFrame = [frameValue CGRectValue];
CGFloat keyboardHeight = keyboardFrame.size.height*kCGPKeyboardAnimationTranslationAdjustmentFactor;
CGFloat animationDuration = [[note userInfo][UIKeyboardAnimationDurationUserInfoKey] doubleValue];
UIViewAnimationOptions animationCurveOption = [[note userInfo][UIKeyboardAnimationCurveUserInfoKey] integerValue] >> 16;
CGPoint submitButtonCenter = [[self submitButton] center];
CGPoint offsetSubmitButtonCenter = CGPointMake(submitButtonCenter.x, submitButtonCenter.y-keyboardHeight);
__block __weak __typeof(self) wSelf = self;
NSCParameterAssert([wSelf isKindOfClass:[self class]]);
[UIView animateWithDuration:animationDuration delay:0.0f options:animationCurveOption animations:^{
[[wSelf submitButton] setCenter:offsetSubmitButtonCenter];
} completion:nil
}];
I는 UIAlertView
- (void)displayError:(NSError*)error {
NSCParameterAssert([NSThread isMainThread]);
NSString *errorDescription = [error description];
UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"" message:errorDescription delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
NSLog(@"%s: Recursive View Description: %@",__PRETTY_FUNCTION__,[[[self view] subviews] description]);
[av show];
NSLog(@"Is it still there? %s Recursive View Description: %@",__PRETTY_FUNCTION__,[[[self view] subviews] description]);
}
버튼 프레임은 [av show]
이 호출 된 직후 변경되어 애니메이션 이전의 정확한 위치로 되돌립니다. [av show]
을 주석 처리하면 버그가 사라지므로 부작용처럼 보입니다.
해당 코드는 없지만 같은 방식으로 이동 한 다른 여러 UIView 및 UITextField 개체가 있습니다. 그들은 영향을받지 않으며 UIButton 만 움직입니다.
누구나 수정 방법에 대한 아이디어가 있습니까?
음, 문제는 당신이 옵션으로 애니메이션 커브를 사용하고 있다는 것입니다. 여기서이 방법으로 사용하면 안됩니다. 문제의 원인이되는 옵션 중 하나 일 수 있습니다. –
@LeoNatan이 애니메이션 옵션 인수를 'UIViewAnimationOptionCurveLinear'로 변경해도 버그가 사라지지 않습니다. –