1
有沒有辦法讓UITableViewRowAnimation同時動畫?UITableViewRowAnimation作爲一個塊(而不是一行)動畫
例如,如果我將4行添加到TableView中,爲4行的塊設置動畫而不是單獨爲兩行設置動畫。
片段,自定義動畫教程等歡迎!
有沒有辦法讓UITableViewRowAnimation同時動畫?UITableViewRowAnimation作爲一個塊(而不是一行)動畫
例如,如果我將4行添加到TableView中,爲4行的塊設置動畫而不是單獨爲兩行設置動畫。
片段,自定義動畫教程等歡迎!
有幾種方法as described in the docs:
批量插入,刪除和行的登陸艦和第
的的UITableView類可以插入,刪除,並重新加載行的一組 或部分,同時以指定的方式動畫操作 。清單 7-7中顯示的八種方法適用於批量插入和刪除。請注意,您可以在動畫塊之外調用 這些插入和刪除方法(如 在數據源方法 tableView:commitEditingStyle:forRowAtIndexPath中的操作:如 「在編輯模式下插入和刪除行」中所述)。
清單7-7批量插入和刪除方法
- (void)beginUpdates;
- (void)endUpdates;
- (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation;
- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
- (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation: (UITableViewRowAnimation)animation;
- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation;
呀,然而,動畫是 - 每一個行向被動畫,我更喜歡新rows-的嵌段動畫 – Dekim