Question

I am not grasping autolayout that well, I guess. I have a simple UITableView on my ipad NIB. I would like this UITableView to grow to occupy 75% of the height in portrait orientation, and shrink to 25% when in landscape mode. Again this is as simple as can be; I just have a NIB with a UITableView plopped onto it.

I'm using ios 6 with autolayout enabled.

Can someone please tell me what the magic autolayout settings are for the constraints? I have played around with content compression and content hugging but nothing seems to change at all. My UITableView height seems to stay at 480 height and never grows.

Thank you!

Was it helpful?

Solution

Try adding a "Top Space to Superview" Vertical Space constraint on the UITableView.

On my iPhone app I have an embedded UITableView that should show below a UIView (with some custom filter options). All worked great in Portrait but in Landscape the UITableview didn't resize. Adding a Vertical Space constraint of 56 to the UITableview and pining the height on the UIView resolved it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top