iOS 7 Back Button Symbol?

后端 未结 7 1890
离开以前
离开以前 2021-02-04 08:12

I really like the shape of the back button arrow in iOS 7, and would like to use it on one of my UIButtons, but like > instead of <. Would there be a way with text, or should

7条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 08:17

    Copy and paste.

    Make the view 32 x 32.

    For the position, iOS usual position is 24 from the left safe area.

    @IBDesignable class BackArrow32Button: UIButton {
      override func draw(_ rect: CGRect) {
        //
        // this is just carefully MATCHED to the Apple one (2019)
        // make the box > 32x32 < and have it > 24 on the left from safe area <
        //
            let bezierPath = UIBezierPath()
            bezierPath.move(to: CGPoint(x: 17, y: 6))
            bezierPath.addLine(to: CGPoint(x: 7, y: 16))
            bezierPath.addLine(to: CGPoint(x: 17, y: 26))
            UIColor.black.setStroke()
            bezierPath.lineWidth = 3
            bezierPath.stroke()
      }
    }
    

    A detail ...

    I didn't add intrinsic content size, since,

    (A) it's probably easier for newer programmers like this

    (B) generally speaking intrinsic size is just broken on interface builder, so for an easy life you're better to just put in the height and width with a constraint :/

提交回复
热议问题