2015-07-21 47 views
0

我在iOS 8中努力尝试在动画过程中粘贴上面的元素时遇到困难。就像在消息中一样,他们通过出现键盘输入信息。我在这里发现了很多主题,但他们都说如何处理出现的键盘,但不是解雇。似乎苹果使用其他曲线或速度任何解雇,所以我有关闭键盘时的异步,而出现动画完全同步。在动画过程中将元素粘贴到键盘底部

这里是我现在有:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHideOrShow:) name:UIKeyboardWillShowNotification object:nil]; 
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHideOrShow:) name:UIKeyboardWillHideNotification object:nil]; 

- (void)keyboardWillHideOrShow:(NSNotification *)note { 
    NSDictionary *userInfo = note.userInfo; 
    CGRect keyboardEndFrame = [userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; 
    [self adjustFormContainerSize]; // Method opening orange card 

    UIViewAnimationCurve curve = [userInfo[UIKeyboardAnimationCurveUserInfoKey] unsignedIntegerValue]; 
    UIViewAnimationOptions options = (curve << 16) | UIViewAnimationOptionBeginFromCurrentState; 
    NSTimeInterval duration = [userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; 

    self.buttonContainerBottom.constant = keyboardEndFrame.size.height; 
    [UIView animateWithDuration:duration 
          delay:0.0 
         options:options 
        animations:^{ 
         [self.view layoutIfNeeded]; 
        } 
        completion:nil]; 
} 

而且结果模拟器:http://monosnap.com/file/BwxJdthPGzCqJnxeQLEg5bb8smvxdb

这有什么错落后动漫,如何将它同步?

+1

你可以让你的自定义查看inputAccesoryView? –

回答