0

Xcode 10.1 Swift 4.2

I am using Master-Detail project. I need to add a bottom tab bar within the detail view but I don't want it to be displayed until an object in the Master view is selected.

Right now i used the "Hidden" option under "Drawing" for the tab bar which hides it during the initial launch, but can't find a way to make it displayed after selecting the master object.

class DetailViewController: UIViewController {

    @IBOutlet weak var detailHeaderLabel: UINavigationItem!
    @IBOutlet weak var detailDescriptionLabel: UILabel!

    func configureView() {
        // Update the user interface for the detail item.
        if let detail = detailItem {
            if let label = detailDescriptionLabel {
                label.text = detail.description
            }
            if let headerLabel = detailHeaderLabel {
                headerLabel.title = detail.description
            }
        }
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        configureView()
    }

    var detailItem: String? {
        didSet {
            // Update the view.
            configureView()
        }
    }


}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Abby
  • 20
  • 5

1 Answers1

0

You need to create the IBOutlet of the tabbar from storyboard and than change is hidden property

DispatchQueue.global(qos: .background).async {
    // Background Thread
    getObjectForMaster()
    DispatchQueue.main.async {
        tabBar.isHidden = false
    }
}
Mihir Mehta
  • 13,743
  • 3
  • 64
  • 88
  • This worked :) thanks so much for the quick and helpful response. Still learning as I go. – Abby Jan 08 '19 at 06:33