【发布时间】:2012-10-15 23:06:23
【问题描述】:
您好,我有一个表格单元格,其中包含一个 UIImageView。我想让这个 UIImageView 有一个圆角。这是我拥有的代码(相关的sn-ps):
UIImageView* image;
image = (UIImageView*)[cell viewWithTag:0]; // get the UIImageView from the nib
image.image = [UIImage imageWithData:imageData]; // imagedata contains the image
image.layer.cornerRadius = 10.0;
image.layer.masksToBounds = YES;
image.clipsToBounds = YES;
当我这样做时,整个 UITableViewCell 会得到圆角,而不是 UIImageView(见附图)。
谁能告诉我为什么圆角应用于表格单元格而不是 uiImageView?
【问题讨论】:
-
因为您将圆角的东西设置为单元格,而不是图像。如果要设置图像“圆角”外观,则需要获取对图像的引用
标签: objective-c ios uitableview rounded-corners