0

I have created the custom class for UITabBar, to design raised button and tabbar strip. Actually İ need to give wave background effect behind the raised button. İ have already created circle and raised button but setting not accurate not wave flow effect. İmage and code attached.

Update:

I have attached my code for download and actual image(tabbar design I need included in assests). Reference link: 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
        }

Actual what İ need to achieve

enter image description here

need this

Community
  • 1
  • 1
Newbie
  • 360
  • 3
  • 19

1 Answers1

0
  • Hmm, you just fixed its position on ViewController.swift, button.frame

  • Simple to decrease y-axis like this

button.frame = CGRect.init(x: self.tabBar.center.x - 32, y: self.view.bounds.height - 80, width: 64, height: 64)
megatunger
  • 72
  • 1
  • 4
  • Thank you but the issue is still persists, your mentioned setting works on İPhone 8 but as we change devices (İPhone XR, XS or İPhone 8 plus) button setting disturbed. How can İ set ıt for all views? – Newbie May 30 '19 at 05:57
  • 1
    Finally i done it button position by using switch statement - UIScreen.nativebound `if UIDevice().userInterfaceIdiom == .phone { switch UIScreen.main.nativeBounds.height { case 1920, 2208: print("iPhone 6+/6S+/7+/8+") case 1792: print("iPhone XR") button.frame = CGRect.init(x: self.tabBar.center.x - 32, y: self.view.bounds.height - 114, width: 64, height: 64)` – Newbie May 30 '19 at 06:11