gpt4 book ai didi

ios - UITableViewCell 中的 UIButton 在 reloadRowsAtIndexPath 上跳转

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

我面临这个奇怪的问题,我的表中的每个单元格只有 UIButton,当我更改它的选定状态以便设置正常的标题颜色时,选定发生,它会产生跳跃效果。还没来得及辨认。任何帮助表示赞赏。提前致谢。

一些代码 -重新加载行 -

`tableView.beginUpdates()
tableView.reloadRowsAtIndexPaths(Array(selectedIndexPaths), withRowAnimation: .None)
tableView.endUpdates()`

在单元格类中设置titlecolor和titleimage -

override func awakeFromNib() {
super.awakeFromNib()
selectionButton.setTitleColor(UIColor(named: .SomeColor), forState: .Normal)
selectionButton.setTitleColor(UIColor(named: .SomeColor), forState: .Selected)
selectionButton.setImage(someimage, forState: .Normal)
selectionButton.setImage(someimage, forState: .Selected
}

This is how it looks

最佳答案

我想先发表评论,但似乎我需要有 50 点声望才能这样做,所以就这样吧。

出现此行为的原因可能是您设置的自定义行高。如果是这种情况,您可以通过为行提供估计高度来防止它。

关于ios - UITableViewCell 中的 UIButton 在 reloadRowsAtIndexPath 上跳转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39935865/

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