美文网首页
iOS UITabBar底部中间突出圆角

iOS UITabBar底部中间突出圆角

作者: CodingTom | 来源:发表于2022-04-08 16:53 被阅读0次
    - (void)createTabBarBGLayer
    {
        _tabBarGBLayer = [CAShapeLayer layer];
    
        UIBezierPath *bezierPath = [UIBezierPath bezierPath];
        [bezierPath moveToPoint:CGPointMake(-1, 0)];
        [bezierPath addLineToPoint:CGPointMake(windWidth / 2 - 25, 0)];
        [bezierPath addQuadCurveToPoint:CGPointMake(windWidth / 2 + 25, 0) controlPoint:CGPointMake(windWidth / 2, -30)];
        [bezierPath addLineToPoint:CGPointMake(windWidth + 1, 0)];
        [bezierPath addLineToPoint:CGPointMake(windWidth + 1, 100)];
        [bezierPath addLineToPoint:CGPointMake(-1, 120)];
        [bezierPath closePath];
    
        _tabBarGBLayer.path = bezierPath.CGPath;
        _tabBarGBLayer.lineWidth = 0.5;
        _tabBarGBLayer.fillColor = [UIColor redColor].CGColor;
        _tabBarGBLayer.strokeColor = [UIColor redColor].CGColor;
        [self.tabBar.layer insertSublayer:_tabBarGBLayer atIndex:0];
    }
    

    相关文章

      网友评论

          本文标题:iOS UITabBar底部中间突出圆角

          本文链接:https://www.haomeiwen.com/subject/xnmysrtx.html