views:

1327

answers:

2

When creating a UIView with a navigation bar in interface builder, the top bar takes some space, but the view still has the same size. This mean that the bottom of the view is not visible.

Is there a way to get the "visible size" of a UIView? I would like to show a subview at the bottom of the screen, but part of the subview is hidden since the parent view goes "below" the screen.

+4  A: 

You should use the 'struts-and-springs' control in IB to set your base view to be full-justified. Then it will auto-resize. Once you do this, you can just use the view.bounds property to access its visible area.

Ben Gottlieb
Works like a charm. Thanks!
Martin Cote
+1  A: 

You should use Ben Gottlieb's solution but in terms of calculating the visible area of a view named "view", you could probably use:

CGRect viewBoundsInWindow =
    [[[UIApplication sharedApplication] keyWindow] convertRect:view.layer.visibleRect fromView:view];
Matt Gallagher