0
私はUIViewController
を持っています。インターネットから画像を読み込み、ナビゲーションtitleViewとして表示したいと思います。ここで ナビゲーションタイトルUIImageViewは中央に位置しません
コードスニペット私のコードです:
let imgView = UIImageView(frame: CGRect(x: 0, y: 0, width: 40, height: 40))
imgView.backgroundColor = UIColor(red: 0.5, green: 0.5, blue: 0, alpha: 0.3)
imgView.image = result.image! //Contains the picture from internet
imgView.contentMode = .ScaleAspectFit
self.navigationItem.titleView = imgView
そして、ここでの結果である:
このhttp://stackoverflow.com/questions/28121388/cant-set-titleview-in-the-center-of-navigation-bar-because-back-buttonを見ます –