你好我有簡單的項目裏面使用UINavigationBar
裏面UIImageView
標誌,但一些意見我的標誌看30-40px
右側或一些意見看50-60px
左側?如何設置navigationItem.titleView圖像的水平中心?
如何設置navigationItem.titleView圖像的水平中心?
我的代碼如下。
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
輸出圖片;
而且當我改變x:50
到x:80
或x:0
等..沒有發生的事情!
可以耀一些輸出做ü需要 –
1秒即時通訊做 – SwiftDeveloper
嘗試設置x原點0 –