我需要给一个 UIImageView
添加圆角。我在论坛上找到了一个解决方案,然后我尝试了下面的代码:
UIImageView * roundedView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wood.jpg"]];
// Get the Layer of any view
CALayer * l = [roundedView layer];
[l setMasksToBounds:YES];
[l setCornerRadius:10.0];
我使用的是iOS 5,但是找不到 setMasksToBounds:YES
和 setCornerRadius
。
那么在我的 UIImageview
中有没有其他方法可以实现圆角呢?
l
赋值回roundedView
的图层属性了吗? - fearmintroundedView.layer = l;
。 - fearmint