2015-07-21 62 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? –

回答

相關問題