
> UITableView row animation duration and completion callback8个
[self.tableVIEw reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0,1)] withRowAnimation:UItableVIEwRowAnimationleft]; [self.tableVIEw reloadRowsAtIndexPaths:@[ [NSIndexPath indexPathForItem:1 inSection:1]] withRowAnimation:UItableVIEwRowAnimationRight];
在上面的代码中,如何在第一行的动画完成后执行第二行?
我试过这个……
[self.tableVIEw beginUpdates];[self.tableVIEw reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0,1)] withRowAnimation:UItableVIEwRowAnimationleft];{ [self.tableVIEw beginUpdates]; [self.tableVIEw reloadRowsAtIndexPaths:@[ [NSIndexPath indexPathForItem:1 inSection:1]] withRowAnimation:UItableVIEwRowAnimationRight]; [self.tableVIEw endUpdates];}[self.tableVIEw endUpdates]; 还有这个…
[self.tableVIEw beginUpdates];{ [self.tableVIEw reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0,1)] withRowAnimation:UItableVIEwRowAnimationleft];}[self.tableVIEw endUpdates];[self.tableVIEw beginUpdates];{ [self.tableVIEw reloadRowsAtIndexPaths:@[ [NSIndexPath indexPathForItem:1 inSection:1]] withRowAnimation:UItableVIEwRowAnimationRight];} ……但无论哪种方式,动画都明显同时发生(当慢动画开启时,动画真的很明显).
解决方法 谢谢IDucool指点我另一个问题.这工作……
[CATransaction begin];[CATransaction setCompletionBlock:^{ [self.tableVIEw reloadRowsAtIndexPaths:@[ [NSIndexPath indexPathForItem:1 inSection:1]] withRowAnimation:UItableVIEwRowAnimationRight];}];[self.tableVIEw reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0,1)] withRowAnimation:UItableVIEwRowAnimationleft];[CATransaction commit]; 我似乎不需要UItableVIEw的beginUpdates和endUpdates.
总结以上是内存溢出为你收集整理的ios – 我如何等待UITableView内置动画完成?全部内容,希望文章能够帮你解决ios – 我如何等待UITableView内置动画完成?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)