如何在我使用保存在调色板中的十六进制颜色的每个地方搜索我的所有 xib 或故事板文件?Xcode 没有帮助我,它只在代码中找到该十六进制颜色的引用。
如果我打开一个 xib 作为源代码,Xcode 所做的就是只保留指向该自定义颜色的指针作为 rgb 值,如下所示:
<color key="backgroundColor" red="X" green="Y" blue="Z" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
Run Code Online (Sandbox Code Playgroud)
堆栈上的另一篇文章描述了相同的问题: XCode ,我可以搜索具有特定十六进制颜色的 xib 文件中的所有视图吗?
任何帮助表示赞赏,谢谢。
更新异步下载图像的图像高度约束后如何更新tableview单元格高度?
图像下载和约束更改后如何触发tableView单元格重新布局?
这样做的最佳方法是什么?
已经尝试将代码放入 Dispatch 主队列,但结果同样糟糕。我在 cellForRow 方法中这样做,也将它移动到 willDisplayCell。一次又一次这个问题...
使用 Kingfisher 库进行图像缓存的代码示例:
if let imgLink = post.imageLink {
if let url = URL(string: imgLink) {
cell.postImage.kf.setImage(with: url, placeholder: UIImage(), options: nil, progressBlock: nil) { (image, error, cacheType, imageURL) in
if let image = image, cell.tag == indexPath.row {
cell.heightConstraint.constant = image.size.height * cell.frame.size.width / image.size.width
}
}
}
}
Run Code Online (Sandbox Code Playgroud)