图片中心透明

_imaegView= [[UIImageViewalloc]initWithFrame:[UIScreenmainScreen].bounds];

self.imaegView.image= [selfgetImage];

self.imaegView.alpha=0.5;

[self.viewaddSubview:self.imaegView];

- (UIImage*)getImage {

UIImage*images = [UIImageimageNamed:@"图片"];

UIGraphicsBeginImageContextWithOptions([UIScreenmainScreen].bounds.size,NO,1);

CGContextRefref =UIGraphicsGetCurrentContext();

[imagesdrawInRect:[UIScreenmainScreen].bounds];

CGContextAddEllipseInRect(ref,CGRectMake(50,100,200,200));

CGContextSetBlendMode(ref,kCGBlendModeClear);

CGContextFillPath(ref);

UIImage*image =UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

returnimage;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1、禁止手机睡眠 [UIApplicationsharedApplication].idleTimerDisabl...
    小热狗阅读 4,425评论 0 2
  • 1.oc基本语法 // // main.m // oc基本语法 // // Created by lanou on...
    GOT_HODOR阅读 3,315评论 0 0
  • 1、设置UILabel行间距 NSMutableAttributedString*attrString=[[NSM...
    iOS祎阅读 6,607评论 0 0
  • 场景做得好 就会批评人设太烂 人设做的好 就会批评音乐太low 音乐做得好 就该批评剧情抄袭 我们来到了一个审美畸...
    一蓑烟雨_886阅读 2,241评论 0 0
  • 刚才内急,想去墙角小便。结果我的“私人厕所”里趴着一只癞蛤蟆,它傲慢无礼,反到让我敬畏。有很多种方法能让它飞起来,...
    三小多阅读 2,675评论 1 1