What is the way to manage this tab bar distribution, I want to add a image next to back button and in the center of the content add a text
My code:
// Create the label
let label = UILabel()
label.text = "Haz tu pedido"
label.sizeToFit()
label.textAlignment = NSTextAlignment.center
label.medium(size: 20, fontFamily: .roboto, color: .white)
label.frame.origin.y = 0
// Create the image view
let image = UIImageView()
image.image = UIImage(named: "IconSmall.png")
let imageAspect = image.image!.size.width/image.image!.size.height
image.frame = CGRect(x: label.frame.origin.x-label.frame.size.height*imageAspect , y: label.frame.origin.y, width: label.frame.size.height*imageAspect, height: label.frame.size.height)
image.contentMode = UIView.ContentMode.scaleAspectFit
let stack = UIStackView(arrangedSubviews: [image,label])
stack.axis = .horizontal
self.tabBarController?.navigationItem.titleView = stack
2
Answers
use. leftBarButtonItem. &. title
You can modify the Back button image and style using UIkit and add a leading icon so it looks like what you need, do note that modifiyng the
navigation bar
will modify it in all the App.