在 UITableViewCell 中显示必须调整大小的图像
您好,我目前在 CoreData 模型中有一个小图像(大约 100x160)作为 NSData 属性。
我在 TableView 中显示所有实体。单个Cell中的UIImageView只有50x80的大小。只是将图像放入此框架中看起来有点卵石状。
在我的 tableViewCell 中显示此图像的最佳解决方案是什么?在我的 cellForRowAtIndexPath 中动态调整它的大小?可能这会导致我的桌面视图变得有点滞后。
在创建时调整它的大小并将其保存在我的 coredata 实体中(或者可能保存在磁盘上)?
谢谢你!如果有不清楚的地方请发表评论
Hi so i currently have a small image (about 100x160) as a NSData Attribute in my CoreData model.
i display all entities in a TableView. The UIImageView in a single Cell has only a size of 50x80. just dropping the image into this frame looks a bit pebbly.
what would be the best solution to display this image in my tableViewCell? resize it on-the-fly in my cellForRowAtIndexPath? probably this will lead up my tableview to become a bit laggy.
resize it on create and save it in my coredata entity (or probably on disk)?
thank you! please leave a comment if something is unclear
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此,您必须裁剪/调整图像大小。以下是根据所需帧裁剪图像的代码。
裁剪图像:
调整图像大小:
您可以使用任何一种方法。
For that you have to crop/resize the image. Following is the code to crop the image as per the required frame.
Crop Image:
Resize Image:
You can go with either of ways.