以下のコードを使用して、キーボードの表示/非表示に応じて UITableView の高さの変化をアニメーション化しています。
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.25];
[UIView setAnimationBeginsFromCurrentState:YES];
CGRect tableFrame = self.messagesTableView.frame;
if (UIInterfaceOrientationIsPortrait(self.interfaceOrientation)) {
tableFrame.size.height -= kKeyboardHeightPortrait;
} else {
tableFrame.size.height -= kKeyboardHeightLandscape;
}
self.messagesTableView.frame = tableFrame;
[UIView commitAnimations];
アニメーションが開始されるとすぐに、表ビューの上半分のセルが消えることを除いて、期待どおりに機能しています。
アニメーション開始前:
アニメーション開始後:
また、テーブル ビューはUIBubbleTableViewのインスタンスであることにも言及する価値があります。