作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用带有动态单元格的 UITableView。每个单元格都有一些按钮、图像和标签。图片的宽度等于tableview的宽度,高度是可变的。
我正在通过一个函数更新 cellForRowAtIndexPath 中图像的高度...以遵守纵横比。标签可以有 1 行或多行。
我正在使用 heightForRowAtIndexPath 来设置单元格的高度。我在那里计算并返回值。
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
let queficient = CGFloat(dataController.Data[indexPath.row].width) / self.view.frame.size.width
let imgHeight = CGFloat(dataController.Data[indexPath.row].height) / queficient
return 134 + imgHeight + heightForView(dataController.Data[indexPath.row].description)
}
我不知道为什么滚动时表格有点滞后和跳跃。
最佳答案
如果您确定延迟是由 heightforRowAtIndexPath 引起的,为什么不在图像更改时只计算一次每个单元格数据/索引路径的高度?
你应该只返回 dataController.Data[indexPath.row].calculatedCellHeight 或其他东西
关于ios - UITableView 很滞后,滚动时会跳动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32847296/
我正在尝试通过在 View 加载后来回更改 alpha 级别来使其中包含图像的 uibutton 缓慢脉动... 目前我正在这样做,但它什么也没做...... -(void)loopdyloop {
我在使用 UITableView 时遇到了这个问题,tableView 的 cells 高度不同,自动布局约束设置不当。当您向下滚动到 tableView 的底部并加载更多数据(无论使用 reload
我是一名优秀的程序员,十分优秀!