Hello I have simple project inside im using UINavigationBar
inside UIImageView
logo but some views my logo looking 30-40px
right side or some views looking 50-60px
left side ?
How to set navigationItem.titleView image horizontal center ?
My codes under below.
navigationController!.navigationBar.barTintColor = UIColor.clearColor()
navigationController!.navigationBar.tintColor = UIColor.whiteColor();
let imageView = UIImageView(frame: CGRect(x: 50, y: 0, width: 164, height: 38))
imageView.contentMode = .ScaleAspectFit
let image = UIImage(named: "logo.png")
imageView.image = image
navigationItem.titleView = imageView
Output picture ;
Also when i change x:50
to x:80
or x:0
etc.. nothing happend !
您可以将x原点设置为0
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 164, height: 38))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.