博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

UIImage rounded corners

Posted on 2013-04-08 17:21  酸梅拯救地球  阅读(153)  评论(0)    收藏  举报

If you are using a UIImageView to display the image you can simply do the following:

imageView.layer.cornerRadius =5.0;
imageView.layer.masksToBounds = YES;

And to add a border:

imageView.layer.borderColor =[UIColor lightGrayColor].CGColor;
imageView.layer.borderWidth =1.0;

I believe that you'll have to import <QuartzCore/QuartzCore.h> and link against it for the above code to work.