gpt4 book ai didi

ios - 设置 imageview 角半径

转载 作者:行者123 更新时间:2023-11-28 21:42:21 24 4
gpt4 key购买 nike

我尝试了大部分解决方法来设置在单元格中找到的 imageview 的角半径。

但是,它仍然显示一个框。我该如何解决这个问题?

cell.imageView.image=[UIImage imageNamed:@"def.png"];
cell.imageView.layer.cornerRadius=cell.imageView.frame.size.width/2;
cell.imageView.layer.borderWidth=3.0f;
cell.imageView.layer.borderColor=[UIColor redColor].CGColor;
cell.imageView.layer.masksToBounds = YES;
cell.imageView.layer.shouldRasterize = YES;

最佳答案

尝试导入 QuartzCore 然后像这样使用 UIImageView 的图层属性:

yourImageView.layer.cornerRadius = 10.0f;
yourImageView.clipsToBounds = YES;

关于ios - 设置 imageview 角半径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31538304/

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