0
votes

I've inherited a project that has a table which displays other viewcontrollers when you select a row. Nothing fancy. However some of the viewcontrollers are UISplitViewControllers. This works fine on the iPad as expected. All buttons show. However on the iPhone when navigating to these controllers, it shows the master controller as expected. But none of the bar buttons show up in the nav bar like they do on the iPad. Any ideas?

How one of the buttons is set:

    let backbtn = UIButton(type: UIButtonType.custom)
    backbtn.setImage(arrowImage, for: UIControlState.normal)
    backbtn.addTarget(self, action: #selector(onBackToTeamListTouch), for: UIControlEvents.touchUpInside)
    backbtn.frame = CGRect(x: -3, y: -1, width: 35, height: 35)
    let backButtonView = UIView(frame: CGRect(x: 0, y: 0, width: 35, height: 35))
    backButtonView.bounds = backButtonView.bounds.offsetBy(dx: 14, dy: 0)
    backButtonView.addSubview(backbtn)
    let backArrow = UIBarButtonItem(customView: backButtonView)
    backArrow.tintColor = .white
    self.navigationItem.leftBarButtonItems = backArrow
1

1 Answers

0
votes

So it looks like on the iPhone if you segue directly to the UISplitViewController you'll lose the nav buttons since the navigation controller is buried underneath. Ended up having to do a conditional in the case of the iPhone and segue to the nav controller of the master view. A bit of a pain but appears to solve the issue.