0

Basically I want to achieve this using UIBarButton:

enter image description here

I tried using setTitle but I end up having something like this:

enter image description here

JVS
  • 2,592
  • 3
  • 19
  • 31

2 Answers2

0

Create your custom navigation bar - add UIView to top of your viewcontroller, and add UIButton in left corner of it. And label underneath button.

Anton Novoselov
  • 769
  • 2
  • 7
  • 19
0

Can be done by using custom view with UIBarButtonItem. Something like this.

Swift

let image = UIImage.init(named: "image_name")
let button = UIButton.init(type: .custom)
button.frame = CGRect.init(x: 0, y: 0, width: 100, height: 40)
button.setBackgroundImage(image, for: .normal)
button.setTitle("title", for: .normal)
let barButtonItem = UIBarButtonItem.init(customView: button)
Bilal
  • 18,478
  • 8
  • 57
  • 72