ios - 插入新行时不会发生行动画

标签 ios swift

我正在学习“开始开发 iOS 应用程序 [Swift]”教程,但在为新插入的行设置动画时似乎存在问题。这是教程中提供的代码。

enter image description here

由于某种原因没有出现动画

最佳答案

尝试在tableView.insertRowsAtIndexPaths之前添加
tableView.beginUpdates()
在 insertRowsAtIndexPaths
之后 tableView.endUpdates()

例子:

tableView.beginUpdates()
tableView.insertRowsAtIndexPaths(indexPath, withRowAnimation: .Bottom)
tableView.endUpdates()

关于ios - 插入新行时不会发生行动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37331580/

相关文章:

arrays - 上下文类型 String、float、f float 不能与数组文字一起使用

swift - 如何将 For 中的 lets 放入表中

ios - Cocoapods - 无法找到 [Github 框架] 的规范

objective-c - 在缩放 UIScrollView subview 时保持恒定的线宽

javascript - React Native 错误找不到模块 'metro-config/src/defaults/blacklist'

ios - 如何从可选函数 didMoveToPage 中获取索引?

swift 可选问题

swift - 分段控制区分按钮

swift - Grand Center Dispatch For Loop

ios - 我可以使用我的应用程序中预填充的数据打开 IOS 日历应用程序的“将事件添加到日历”屏幕吗?