我有一个正在使用的图像而不是导航栏中的文本,我希望该图像充当一个按钮并打开另一个视图控制器。为什么这不起作用。我没有收到任何错误。
override func viewDidLoad() {
super.viewDidLoad()
let titleView = UIView(frame: CGRect(0, 0, 40, 40))
let titleImageView = UIImageView(image: UIImage(named: "titleimage"))
titleImageView.frame = CGRect(0, 0, titleView.frame.width, titleView.frame.height)
titleImageView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(specialController)))
}
@objc func specialController() {
let picker = SpecialMessage()
present(picker, animated: true, completion: nil)
}