我有查看鍵入消息,如下所示。移動視圖以同時重置框架和鍵盤
現在,當I型消息,鍵盤出現並且示於下面的圖中的框應當移動的正上方的鍵盤。
我的問題 他們的鍵盤動畫和觀看動畫出現在不同的時間。鍵盤出現,然後出現視圖。即使我試圖將動畫時間設置爲任何時間,它們都會在不同的時間出現。
我該如何解決我的問題?
請建議我解決它的方式,以便鍵盤和視圖動畫顯示,如果他們是相同的看法。兩個動畫都應該在確切的時間發生,以便它們看起來像是同時出現的相同視圖。
我試圖
我的看法沒有負載有以下代碼
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
現在鍵盤顯示功能看起來像
- (void)keyboardWillShow:(NSNotification *)note{
NSDictionary* keyboardInfo = [note userInfo];
CGFloat duration = [[keyboardInfo objectForKey:UIKeyboardAnimationDurationUserInfoKey] floatValue];
[UIView animateWithDuration:duration animations:
^{
//chat_typingView is name for typing view
chat_typingView.frame = CGRectMake(chat_typingView.frame.origin.x,
238,
chat_typingView.frame.size.width,
chat_typingView.frame.size.height);
}