JSQmessageViewControllerを使用していて、ナビゲーションバーに「戻る」ボタン&のユーザー画像をプログラムで追加しようとしています。私は次のコードを使用しています。それを実行した後、 "戻る"ボタンや画像はありません。添付されているのは、シミュレータのスクリーンショットです。私は通常のUIViewControllerでこれらのコードをテストし、彼らは働いた。JSQmessageView Controller:Swiftのナビゲーションバーに「戻る」ボタンと画像を追加
なぜJSQmessageViewControllerで動作しないのか分かりますか?ナビゲーションバーに「戻る」ボタン&イメージを追加するにはどうすればよいですか?どうもありがとう!
let navigationBar = UINavigationBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 64))
navigationBar.backgroundColor = UIColor.whiteColor()
navigationBar.delegate = self;
let navigationItem = UINavigationItem()
navigationItem.title = strValue
let leftButton = UIBarButtonItem(title: "Back", style: UIBarButtonItemStyle.Plain, target: self, action: "back:")
self.navigationItem.leftBarButtonItem = leftButton
let imgButton = UIButton()
imgButton.setImage(image, forState: .Normal)
imgButton.addTarget(self, action: "EditProfile:", forControlEvents: UIControlEvents.TouchDown)
imgButton.frame = CGRectMake(self.view.frame.width - 60, 0, 41, self.view.frame.height)
var rightButton = UIBarButtonItem(customView: imgButton)
self.navigationItem.rightBarButtonItem = rightButton
navigationBar.items = [navigationItem]
self.view.addSubview(navigationBar)
}
添付のスクリーンショットが表示されません。 –