0

I have a UITableView that displays some data that is read in at runtime and features a button below it that will refresh the list when clicked. All of that works fine, however there is a problem with the layout on the simulator.

When I run, there is a space at the bottom of the table that pushes the refresh button down. No matter how long the UITableView is, the UIButton will always be kept at that extended distance. If I overlay the bottom with the UIButton, it does display with slightly less padding. I am at a loss of how to fix this.

Image with example of behaviour: http://img864.imageshack.us/img864/9913/screenshot20120326at113.png

Parth Bhatt
  • 19,381
  • 28
  • 133
  • 216
joverboard
  • 335
  • 1
  • 3
  • 13

3 Answers3

3

I think the problem is that in the interface builder your layout does not show at the same size, because it lacks the navigation bar at the top.

In the visual editor, choose the window hosting your table view, go to the attribute inspector, and choose Navigation bar for the Top Bar entry in the Simulated Metrics section of the inspector. The layout of your design will change. Resize your table view, move your button, rebuild the app, and run it again; this should do the trick.

Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
  • I had tried several times to size it according to the navigation bar with no change in results, but adding the `simulated metrics` ended up showing the improperly sized `UITableView` for what it was. Still not sure why the version with metrics shrunk so much, but what works, works. – joverboard Mar 26 '12 at 21:06
1

It looks like it's because you're designing without the navigation bar simulated and you've set up your autoresizing masks incorrectly.

What you can do is either enable the simulated metric (attributes inspector in IB with the main view selected) for the top bar set to Navigation Bar, or you can go and fix your autoresizing masks. They are the red things in the size inspector in IB.

mattjgalloway
  • 34,792
  • 12
  • 100
  • 110
1

It is because when you designed the screen you didn't consider the navigation bar that is gonna come. Simply add a bar to the screen on the top and rearrange the table and button with proper autoresizing masks. It will fit.

cocoakomali
  • 1,346
  • 1
  • 8
  • 7