UIImageView * headerImage = [[UIImageView alloc] initWithFrame:CGRectMake(10.0, 10.0, 64.0, 64.0)]; headerImage.image = contactPhoto; CALayer * layer = [headerImage layer]; [layer setMasksToBounds:YES]; [layer setCornerRadius:10.0]; [layer setBorderWidth:1.0]; [layer setBorderColor:[[UIColor blackColor] CGColor]]; [contactHeader addSubview:headerImage];
记得头文件:#import <QuartzCore/QuartzCore.h>