Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Introduction to Table Views Decoupling the Data Source Refactoring the Data Source

Roberto Merizalde
Roberto Merizalde
3,894 Points

How to allow the tableView to retake a full screen status when in landscape?

I added an UIView on top of the Master tableView (not the Detail view) to display an image along with some text... the idea is: as the user types on any of the contact cells (while still in Portrait mode) the corresponding Avatar and text will appear above, So I was able to do that... However even though I was able to command all the element in the UIView and the UIview itself to hide (isHidden = true) when in Landscape..... There is STILL a space, and the tableView won't take its full screen when in Landscape.. How can I command the tableView on the master to resize to full screen when in landscape... I used this code to detect the transition.. which works.. I only need to know how to command the table view to resize. - much appreciated in advance!.

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
        super.viewWillTransition(to: size, with: coordinator)
        if UIDevice.current.orientation.isLandscape {

            subView.isHidden = true
            print("Landscape")
        } else {

            subView.isHidden = false
            print("Portrait")
        }
    }