开发者

Must I call -reloadRowsAtIndexPaths:withRowAnimation: inside an -beginUptades -endUpdates block?

开发者 https://www.devze.com 2022-12-27 08:27 出处:网络
Must I call -reloadRowsAtIndexPaths:withRowAni开发者_如何学Gomation: inside an -beginUptades -endUpdates block?It depends what you are trying to do.

Must I call -reloadRowsAtIndexPaths:withRowAni开发者_如何学Gomation: inside an -beginUptades -endUpdates block?


It depends what you are trying to do.

You should use beginUpdates/endUpdates for "subsequent insertions, deletion, and selection operations (for example, cellForRowAtIndexPath: and indexPathsForVisibleRows) to be animated simultaneously" (from UITableView beginUpdates)

However, if all you need to do is update the value of something in a cell you don't need the -reloadRowsAtIndexPaths call to be inside a beginUpdates/endUpdates. You can actually just grab the cell directly and update the value in a lot of cases.

See UITableView -reloadRowsAtIndexPaths for more specifics

0

精彩评论

暂无评论...
验证码 换一张
取 消