// // RDImageView.m // // Created by apple on 15/11/27. // Copyright (c) 2015年 apple. All rights reserved. // #import "RDImageView.h" @implementation RDImageView -(instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self setBackgroundColor:[UIColor clearColor]]; } return self; } -(void)drawRect:(CGRect)rect { //圆的线条宽度 CGFloat lw ; lw = 0; if (_color) { lw = 3.5; } UIColor *col = _color; [col set];//设置线条颜色 CGFloat d = self.frame.size.width * .8; CGFloat x = (self.frame.size.width - d)/2.0; UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(x, x, d, d)]; path.lineWidth = lw; [path stroke];//空心的图形 [path addClip]; [_image drawInRect:self.bounds]; } @end