gpt4 book ai didi

objective-c - UITableViewRowAnimation 作为 block (而不是行)动画

转载 作者:行者123 更新时间:2023-11-28 17:40:32 26 4
gpt4 key购买 nike

有没有办法同时制作 UITableViewRowAnimation 动画?

例如,如果我向 TableView 添加 4 行,则为 4 行的 block 设置动画而不是分别为两行设置动画?

欢迎使用自定义动画的代码片段、教程等!

最佳答案

有几种方式as described in the docs :

Batch Insertion, Deletion, and Reloading of Rows and Sections

The UITableView class allows you to insert, delete, and reload a group of rows or sections at one time, animating the operations simultaneously in specified ways. The eight methods shown in Listing 7-7 pertain to batch insertion and deletion. Note that you can call these insertion and deletion methods outside of an animation block (as you do in the data source method tableView:commitEditingStyle:forRowAtIndexPath: as discussed in “Inserting and Deleting Rows in Editing Mode”).

Listing 7-7 Batch insertion and deletion methods

- (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;

关于objective-c - UITableViewRowAnimation 作为 block (而不是行)动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8337018/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com