gpt4 book ai didi

ios - 单击 CustomTableCell 中的图像会调整大小

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:12:40 25 4
gpt4 key购买 nike

如果没有项目,这是不可能解释的,因此我上传了一个小的 DEMO在 GitHub 上。

我不认为约束是错误的。图像应固定在其位置。最初 SDWebImage 从缓存中检索图像,但一旦我点击图像,图像就会调整大小。 (它变小了,见上图)

enter image description here

有趣的是,在我的演示中,图像首先显示为红色方 block 。单击它们后,imageView 会调整大小并加载实际图像。不过,这仍然显示出问题。

enter image description here

在我看来,初始缓存没有根据约束调整大小。这是真的吗?

最佳答案

我试过你的代码

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
BookmarkTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:bookmarkcellIdentifier forIndexPath:indexPath];

News *news = [_news objectAtIndex:indexPath.row];
cell.headLine.text = news.headLine;

[cell.newsImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",news.imageUrlList]] placeholderImage:[UIImage imageNamed:@"iTagImageHolder"]];
[cell.newsImage.layer setBorderWidth: 2.0];
[cell.newsImage.layer setBorderColor: [[UIColor blackColor] CGColor]];


return cell;
}

我得到了这样的输出

enter image description here

在 Storyboard 中,我在“属性检查器”中选择了 Autoresize subviews

enter image description here

关于ios - 单击 CustomTableCell 中的图像会调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32518064/

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