views:

240

answers:

2

I have an application with a tab bar controller and a navigation controller. In one of the child content views of the navigation controller, I have a image view at the top and some buttons at the bottom. The problem is that the navigation bar obscures the top portion of the image view. My content view is loaded from a NIB file and the image is set at run time. The strange thing is, in another child view I have a table view and that appears correctly.

A: 

Could it be you have set the content view too large? In InterfaceBuilder, you can enable a placeholder tabbar + navigationbar in cmd+1 of your view. That way you can design it to fit exactly. Alternatively you can fix the size of the content frame unter cmd+3 in IB.

Hauke
+1  A: 

First, make sure your your autoresizingMask is set properly on your view (see autosizing settings in size inspector, CMD+3). UINavigationController overview at iPhone Dev Center says:

Note: Because the amount of space available for the custom view can vary (depending on the size of the other navigation views), your custom view’s autoresizingMask property should be set to have a flexible width and height. Before displaying your view, the navigation controller automatically positions and sizes it to fit the available space.

Then, make sure that the autosizing settings on your imageview is not set to flexible height.

What might be happening is:

  1. UINavigationController resizes your view from nib file (shrinks the height).
  2. UIImageView in your view is scaled down because the parent view was resized, which makes it look like it's clipped.
yood