半圆往view中间凹陷

  UIView *tgBlackView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];

        tgBlackView.backgroundColor = tgrgba(34, 34, 34, 1);

        tgBlackView.alpha = 0.58;

        [self addSubview:tgBlackView];

        

        int tgLogImageViewW = 110;

        int tgWhiteViewH = 250;

        UIView *tgWhiteView = [[UIView alloc]initWithFrame:CGRectMake(20, kScreenHeight-kTabBarBottomHeight-tgWhiteViewH, kScreenWidth-40, tgWhiteViewH)];

        tgWhiteView.backgroundColor = [UIColor clearColor];

        tgWhiteView.layer.cornerRadius = 17;

        tgWhiteView.layer.masksToBounds = YES;

        [self addSubview:tgWhiteView];

        

        //圆图片

        UIImageView *tgLogImageView = [[UIImageView alloc]initWithFrame:CGRectMake((kScreenWidth-tgLogImageViewW)/2, tgWhiteView.frame.origin.y-tgLogImageViewW/2, tgLogImageViewW, tgLogImageViewW)];

        tgLogImageView.image = [UIImage imageNamed:@"fresh_update"];

        tgLogImageView.backgroundColor = tgrgba(65, 171, 166, 1);

        tgLogImageView.layer.cornerRadius = tgLogImageView.frame.size.height/2;

        tgLogImageView.layer.masksToBounds = YES;

        tgLogImageView.contentMode = UIViewContentModeScaleAspectFill;

        [self addSubview:tgLogImageView];

        

        

        // 创建一个CAShapeLayer

        CAShapeLayer *shapeLayer = [CAShapeLayer layer];

        UIBezierPath *path = [UIBezierPath bezierPath];

        CGFloat radius = tgLogImageViewW/2+8; // 半径

        [path moveToPoint:CGPointMake(0, 0)];

        [path addLineToPoint:CGPointMake(0, tgWhiteView.bounds.size.height)];

        [path addLineToPoint:CGPointMake(tgWhiteView.bounds.size.width, tgWhiteView.bounds.size.height)];

        [path addLineToPoint:CGPointMake(tgWhiteView.bounds.size.width, 0)];

        [path addArcWithCenter:CGPointMake(tgWhiteView.bounds.size.width / 2, 0)

                        radius:radius

                    startAngle:0

                      endAngle:M_PI

                     clockwise:YES];

        [path addLineToPoint:CGPointMake(0, 0)];

        [path closePath];

        // 设置CAShapeLayer的路径

        shapeLayer.path = path.CGPath;

        // 设置填充颜色为透明

        shapeLayer.fillColor = [UIColor whiteColor].CGColor;

        // 添加CAShapeLayer到白色的UIView的layer

        [tgWhiteView.layer addSublayer:shapeLayer];

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值