[Objective-C] Create Round UIImageView

#import < QuartzCore/QuartzCore.h>

CALayer *imageLayer = myImageView.layer;
CGFloat height = imageLayer.frame.size.height;
CGFloat width = imageLayer.frame.size.width;
CGFloat roundRadius = height > width ? width / 2 : height / 2;

[imageLayer setCornerRadius:roundRadius];
[imageLayer setBorderWidth:1];
[imageLayer setMasksToBounds:YES];
[imageLayer setBorderColor:[[UIColor redColor] CGColor]];



沒有留言: