gpt4 book ai didi

ios - 能否在 detailTextLabel 单元格中显示小图像?

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

所以我想知道是否可以在单元格的 detailTextLabel 中显示小图像? (我从 URL 获取图像)我试过:

NSString *thumbs = [NSString stringWithFormat:@"%@", TableText3];
cell.detailTextLabel.text = thumbs;

由于显而易见的原因,这是行不通的。我也试过:

UIImage *thumbs = [UIImage imageWithData:[NSData dataWithContentsOfURL:
[NSURL URLWithString:TableText3]]];
cell.detailTextLabel.text = thumbs;

这也(显然)不起作用,因为我将图像传递给字符串参数。

令人惊讶的是,我在 WWW 上没有找到任何东西。 (搜索参数是:“image in detailTextLabel”或图片或只是 textlabel 和图像以及各种变体)

最佳答案

不能直接放到标签中,因为标签只显示文字。但是您可以使用 UITableViewCell 的 imageView 属性。

cell.imageView = [[UIImageView alloc] initWithImage: thumbs];

https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewCell_Class/Reference/Reference.html

关于ios - 能否在 detailTextLabel 单元格中显示小图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9574795/

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