我需要将圆角添加到UIImageView
。我从论坛中找到了一个解决方案,并且我尝试了下面的代码;圆角UIView或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'的图层属性? – JoePasq 2011-12-29 15:16:29
怎么样?能告诉我它会是什么样子? – Illep 2011-12-29 15:25:45
'roundedView.layer = l;'我还没有尝试过。 – JoePasq 2011-12-29 15:54:47