iphone app 为图片添加边框

头文件中#import <QuartzCore/QuartzCore.h>
当然Framework中需要有QuartzCore.framework

UIImageView* leftView = [[UIImageView alloc] init];
    leftView.contentMode = UIViewContentModeScaleAspectFit;
    leftView.tag = AlbumTableViewCell_LeftImageView;


/*加边框*/
    leftView.layer.masksToBounds=YES;
    leftView.layer.cornerRadius=2.0; //圆角弧度
    leftView.layer.borderWidth=1.0; //边框宽
    leftView.layer.borderColor=[[UIColor grayColor] CGColor];

你可能感兴趣的:(iPhone)