記得framework需要加QuartzCore.framework
並且
#import <QuartzCore/QuartzCore.h>
UIImageView *img = [[UIImageView alloc] initWithFrame:imgframe];
[img setImage:image];
img.layer.cornerRadius = 3;
img.layer.masksToBounds = YES;
img.layer.borderWidth = 1;
img.layer.borderColor = [[UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0] CGColor];