ios 图片裁剪加背景光环
2016-04-12 18:53
399 查看
UIImage *image = [UIImage
imageNamed:@"knockwurst.jpg"];
UIGraphicsBeginImageContextWithOptions(CGSizeMake(image.size.width+10,
image.size.height+10),
NO, 0);
NSLog(@"%f,%f",image.size.width,image.size.height);
UIBezierPath *path = [UIBezierPath
bezierPathWithOvalInRect:CGRectMake(0,
0, image.size.width+10, image.size.height+10)];
[path addClip];
[[UIColor
greenColor] set];
[path fill];
UIBezierPath *path1 = [UIBezierPath
bezierPathWithOvalInRect:CGRectMake(5,
5, image.size.width, image.size.height)];
[path1 addClip];
[image drawAtPoint:CGPointMake(5,
5)];
UIImage *image1 =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *view = [[UIImageView
alloc]initWithFrame:CGRectMake(50,
300, 200,
200)];
view.image = image1;
[self.view
addSubview:view];
imageNamed:@"knockwurst.jpg"];
UIGraphicsBeginImageContextWithOptions(CGSizeMake(image.size.width+10,
image.size.height+10),
NO, 0);
NSLog(@"%f,%f",image.size.width,image.size.height);
UIBezierPath *path = [UIBezierPath
bezierPathWithOvalInRect:CGRectMake(0,
0, image.size.width+10, image.size.height+10)];
[path addClip];
[[UIColor
greenColor] set];
[path fill];
UIBezierPath *path1 = [UIBezierPath
bezierPathWithOvalInRect:CGRectMake(5,
5, image.size.width, image.size.height)];
[path1 addClip];
[image drawAtPoint:CGPointMake(5,
5)];
UIImage *image1 =
UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageView *view = [[UIImageView
alloc]initWithFrame:CGRectMake(50,
300, 200,
200)];
view.image = image1;
[self.view
addSubview:view];
相关文章推荐
- iOS开发---阿里巴巴IconFont适配技术
- IOS下的 NSTimer与Run loop Modes
- IOS使用ijkPlayer
- ios - loadView与viewDidload
- [IOS]Protocol协议及委托代理(Delegate)传值-用代码寻找storyboard相应视图
- ShareSDK在iOS9下注意事项
- iOS设备唯一标识(可以用版)
- iOS 关于信鸽推送点击推送通知的处理
- iOS 最简单的资料
- iOS 客户端MD5加密方法
- iOS中 imageNamed方法 非常多图片占用大量内存问题
- 应用之间跳转进行传值
- iOS之JSON解析和视频的简单播放
- 纪念一下我的短暂的ios时光
- iOS Core Animation系列之CADisplayLink
- ios-常见的循环引用
- iOS多线程编程之NSOperation
- iOS开发之百度地图大头针的自定义解决方法
- iOS中的initialize与load两个类方法简单理解
- ios开发常用的技巧