0

I have two table views, both without table view controllers, I have a view controller that's taking care of both of them.

The problem is that I'm getting weird scalings of the tables on different devices. It seems to be almost perfect on the iPhone 4 simulator. The table looks almost ridiculous on any iPad simulator.

My Table Views View settings look like this:

settings

scale to fill

I tried changing the launch images to see if that would have any impact on scaling/zooming/etc, but that didn't really seem to change anything.

  • How Can I Get My Table Views To Automatically Fill The Whole Screen On A Universal App?

edit:

alignment constraints are disabled:

constraints

Mou某
  • 556
  • 3
  • 10
  • 32

2 Answers2

1

If you are using the autolayout give constaints to table view as leading, trailing, top & bottom. It will change its size as per device.

swapnali patil
  • 304
  • 2
  • 17
  • the leading, trailing, top & bottom constraints are greyed-out?! – Mou某 Jul 20 '15 at 11:13
  • Can you please try by clearing all the constraints of the view & then add new constraints. Remember while adding constraint uncheck the constraints to margin button – swapnali patil Jul 20 '15 at 11:33
  • I don't have any constraints at the moment, but they seem to be all disabled. – Mou某 Jul 20 '15 at 11:36
  • can you share the screenshot of how you are setting the constraints if possible – swapnali patil Jul 20 '15 at 11:43
  • I updated my question with a screenshot of the disabled constraints I was trying to add – Mou某 Jul 20 '15 at 11:46
  • Hope it will work, Their is one more way to add constraint, select the tableView from sidemenu hierarchy from storyboard, press Ctrl & drag from tableview to it's super view. then one popup will appear from their You select leading , trailing , top & bottom contraints – swapnali patil Jul 20 '15 at 11:59
  • Worked! Excellent, thanks so much. One problem: I don't think it's counting my nav bar - so I have a bunch of things hidden behind the nav bar - any tips? – Mou某 Jul 20 '15 at 12:17
  • Yes...While adding constraint to viewcontroller first you select the device screen size as 3.5 inch & add topbar as translusent navigation bar. & then only you put your objects in the view & set the constraints so that nothing is hidden under navigation bar – swapnali patil Jul 20 '15 at 12:22
0

You need to set the frame of the table view to occupy the whole screen

UITableView tableView = [[UITableView alloc]  initWithFrame:self.view.bounds];
Mahmoud Adam
  • 5,772
  • 5
  • 41
  • 62