UITableViewCell の アニメーション
どうやら、UITableViewCellを追加、削除、refreshするときのアニメーションがデフォルトで用意されている模様。
指定出来るアニメーションは以下の通り。
(例)
リロードする場合は、UITableViewControllerのサブクラス内で、 - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; を以下の様に使用すればOK。
復習も兼ねて、全てのAnimationを確認するためのサンプルコードを作成した。
サンプルコード
https://github.com/AlginPlus/TableCellAnimationSample
指定出来るアニメーションは以下の通り。
typedef NS_ENUM(NSInteger, UITableViewRowAnimation) {
UITableViewRowAnimationFade,
UITableViewRowAnimationRight,
UITableViewRowAnimationLeft,
UITableViewRowAnimationTop,
UITableViewRowAnimationBottom,
UITableViewRowAnimationNone,
UITableViewRowAnimationMiddle,
UITableViewRowAnimationAutomatic = 100
};(例)
リロードする場合は、UITableViewControllerのサブクラス内で、 - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; を以下の様に使用すればOK。
[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0]
withRowAnimation:UITableViewRowAnimationAutomatic];
復習も兼ねて、全てのAnimationを確認するためのサンプルコードを作成した。
サンプルコード
https://github.com/AlginPlus/TableCellAnimationSample

コメント
コメントを投稿