Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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")
        }
    }