需要快速设计自定义选项卡4。 -更新

时间:2019-05-29 11:39:30

标签: ios swift uitabbarcontroller uitabbar

我为UITabBar创建了自定义类,以设计凸起的按钮和标签栏。实际上,©需要在凸起的按钮后面提供波浪背景效果。 İ已经创建了圆圈和凸起按钮,但设置不准确不是波浪效果。 İmage和附带的代码。

更新:

我已附上我的代码以供下载和实际使用图像(资产中需要包含标签栏设计)。 参考链接:https://drive.google.com/file/d/1evDPYdG2fGiMohWohJR2BQJNsKJHStQy/view?usp=sharing

func createPathCircle() -> CGPath {

            let radius: CGFloat = 40.0
            let path = UIBezierPath()
            let centerWidth = self.frame.width / 2

            path.move(to: CGPoint(x: 0, y: 0))
            path.addLine(to: CGPoint(x: (centerWidth - radius * 2), y: 0))
            path.addArc(withCenter: CGPoint(x: centerWidth, y: 0), radius: radius, startAngle: CGFloat(180).degreesToRadians, endAngle: CGFloat(0).degreesToRadians, clockwise: true)
            path.addLine(to: CGPoint(x: self.frame.width, y: 0))
            path.addLine(to: CGPoint(x: self.frame.width, y: self.frame.height))
            path.addLine(to: CGPoint(x: 0, y: self.frame.height))
            path.close()
            return path.cgPath
        }

实际需要达到的目标

enter image description here

need this

1 个答案:

答案 0 :(得分:0)

  • 嗯,您刚刚将其位置固定在ViewController.swift,button.frame

  • 像这样简单地减小y轴

button.frame = CGRect.init(x: self.tabBar.center.x - 32, y: self.view.bounds.height - 80, width: 64, height: 64)
相关问题