[英]Navigation Item Swift 3 to Swift 4
我一直遇到的問題是,在下載Xcode 9之后,我的應用程序的用戶界面已經混亂了。
let item1 = UIBarButtonItem(image: #imageLiteral(resourceName: "SettingsInto"), style: .done, target: self, action: #selector(settingsPressed))
self.navigationItem.setRightBarButton(item1, animated: true)
let item2 = UIBarButtonItem(image: #imageLiteral(resourceName: "search icon"), style: .plain, target: self, action: #selector(searchPressed))
self.navigationItem.setLeftBarButtonItem(item2, animated: true)
let imageButton = UIButton(frame: CGRect(x: 0, y: 0, width: 0, height: navigationBarHeight))
let image = #imageLiteral(resourceName: "Stickiie Logo Main")
imageButton.setImage(image, for: UIControlState())
imageButton.imageView?.contentMode = .scaleAspectFit
imageButton.addTarget(self, action: #selector(refresh), for: .touchDown)
self.navigationItem.titleView? = imageButton
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.