【发布时间】:2017-09-29 00:34:04
【问题描述】:
我一直遇到的问题是,在我下载了 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
【问题讨论】:
-
您可以尝试使用 Storyboards 执行此操作,看看是否可行?
-
嘿!不幸的是,它没有用,但它让我意识到这是因为图标的尺寸太大了。非常感谢您的建议!
标签: ios xcode ios11 swift4 xcode9