Basically I want to achieve this using UIBarButton
:
I tried using setTitle
but I end up having something like this:
Basically I want to achieve this using UIBarButton
:
I tried using setTitle
but I end up having something like this:
Create your custom navigation bar - add UIView to top of your viewcontroller, and add UIButton in left corner of it. And label underneath button.
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)