gpt4 book ai didi

ios - UITableViewCell imageView 重叠单元格中的文本

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

我有一个单元格,里面有一些文本,我正在尝试向单元格添加图像。

这是我试过的:

UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(30, 30, 30, 30)];
imageView.backgroundColor = [UIColor clearColor];
[imageView.layer setCornerRadius:5.0f];
[imageView.layer setMasksToBounds:YES];
[imageView setImage:[UIImage imageNamed:@"test2.jpeg"]];
[cell.contentView addSubview:imageView];
cell.imageView.clipsToBounds = YES;

这是现在的样子:

enter image description here

有没有办法避免图像与单元格中的文本重叠?提前致谢!

最佳答案

tableviewcells 有自己的 imageView,将显示在内容的左侧或至少显示在单元格文本的左侧。

您正在创建一个恰好具有相同名称的额外 imageView。

关于ios - UITableViewCell imageView 重叠单元格中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20863232/

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