Ich habe zwei UIButton auf der rechten Seite der Navigationsleiste von UIViewController, UIbuttons haben Bilder. Die App funktionierte gut, bis sie in Xcode 8 lief, aber wenn ich Xcode 9 aktualisierte, wird es nicht gerendert, es dauert ganze Navigationsleiste. In Xcode 8 war es Bild in Navigationsleiste Schaltfläche nicht nach dem Update auf Xcode 9
aber nach 9 bis Xcode Aktualisierung sieht es aus wie dieses
Mein Code navbar auf Einstellung ist ...
func setUpNavBar(){
self.navigationController?.navigationBar.isTranslucent = false
self.navigationItem.setHidesBackButton(true, animated: true)
let notificationBtn = UIButton(type: .custom)
notificationBtn.setImage(UIImage(named: "notificationIcon"), for: .normal)
notificationBtn.frame = CGRect(x: 0, y: 0, width: 35, height: 35)
notificationBtn.addTarget(self, action: #selector(HomeViewController.notificationClicked), for: .touchUpInside)
let item1 = UIBarButtonItem(customView: notificationBtn)
let profileBtn = UIButton(type: .custom)
profileBtn.setImage(UIImage(named: "user_profile"), for: .normal)
profileBtn.frame = CGRect(x: 0, y: 0, width: 35, height: 35)
profileBtn.addTarget(self, action: #selector(HomeViewController.ProfileClicked), for: .touchUpInside)
let item2 = UIBarButtonItem(customView: profileBtn)
self.navigationItem.setRightBarButtonItems([item1,item2], animated: true)
}
Ich bin sehr verwirrt, warum es passiert.
ich denke, du solltest als duplikat lol markieren –
Es funktioniert dank mann – Prathamesh