1
我在我的導航控制器中創建了2個海關按鈕。我有一個左鍵和一個右鍵,並且都有一些文本+箭頭圖標。由於我更新到iOS 11,圖標的大小已經改變,我不知道爲什麼。使用Swift的iOS 11中的imageView
這這個iOS的10(左)和iOS 11(右)的區別:
我怎樣才能改變這種狀況?
這一塊我的代碼:
func addRightButton(){
rightButton = UIButton.init(type: .custom)
rightButton.setImage(UIImage(named: "back"), for: .normal)
rightButton.imageView?.contentMode = .scaleAspectFit
let width = UIScreen.main.bounds.size.width
if width < 375 {
rightButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: UIFont.Weight.bold)
rightButton.frame = CGRect.init(x: 0, y: 0, width: 75, height: 10)
} else {
rightButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.bold)
rightButton.frame = CGRect.init(x: 0, y: 0, width: 100, height: 10)
}
rightButton.imageView!.transform = rightButton.imageView!.transform.rotated(by: CGFloat((Double.pi/2) * -1))
rightButton.setTitle(" Mixte",for: .normal)
rightButton.addTarget(self, action: #selector(self.switchSex(_:)), for: UIControlEvents.touchUpInside)
let barButton = UIBarButtonItem(customView: rightButton)
self.navigationItem.rightBarButtonItem = barButton
}
這就是我所做的只是現在。但似乎難以集中按鈕。 (超過iOS 10) – KevinB