-(UIImage*) myMethod2{
UIGraphicsBeginImageContext(CGSizeMake(140.0f, 140.0f)); //设置画布大小
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,[[UIColor greenColor]CGColor]); //设置填充颜色
CGContextAddEllipseInRect(context, CGRectMake(50.0f, 50.0f, 40.0f, 40.0f)); //设置填充形状
CGContextFillPath(context); //进行填充路径
CGContextClip(context); //进行剪贴
CGContextSetStrokeColorWithColor(context,[[UIColor whiteColor]CGColor]); //设置画笔颜色
CGContextAddEllipseInRect(context, CGRectMake(52.0f, 52.0f, 36.0f, 36.0f));//设置形状
CGContextStrokePath(context); //进行绘画
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
UIGraphicsBeginImageContext(CGSizeMake(140.0f, 140.0f)); //设置画布大小
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context,[[UIColor greenColor]CGColor]); //设置填充颜色
CGContextAddEllipseInRect(context, CGRectMake(50.0f, 50.0f, 40.0f, 40.0f)); //设置填充形状
CGContextFillPath(context); //进行填充路径
CGContextClip(context); //进行剪贴
CGContextSetStrokeColorWithColor(context,[[UIColor whiteColor]CGColor]); //设置画笔颜色
CGContextAddEllipseInRect(context, CGRectMake(52.0f, 52.0f, 36.0f, 36.0f));//设置形状
CGContextStrokePath(context); //进行绘画
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}