I have two UIButton on the right side of navigation bar of UIViewController, UIbuttons have images. The app was working fine till it was running in Xcode 8, but when I updated Xcode 9 it is not rendering, it is taking whole navigation bar.
In Xcode 8 it was
but after updating to Xcode 9 it looks like this
My code to setting navbar is ...
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)
}
I am very confused why it is happening.