Resizing Tab Bar Controller Views (iPhone dev)

Posted by damiandawber on Stack Overflow See other posts from Stack Overflow or by damiandawber
Published on 2010-06-12T12:03:45Z Indexed on 2010/06/12 12:13 UTC
Read the original article Hit count: 282

Hello,

I have an application set up where the window contains a tab bar controller and one of the tabs loads a NIB called 'ShowCaseView.xib': this file is owned by a custom ShowcaseViewController class.

In the ShowcaseViewcontroller class I have added a UIScrollView object, like so:

imageScrollView = [[UIScrollView alloc] initWithFrame:[[self view] bounds]];
[[self view] addSubview:imageScrollView];

The issue I am having is that this UIScrollView object extends beneath my tab bar controller.

So I have had to reduce its insets manually:

#define TAB_BAR_HEIGHT 48
.
.
UIEdgeInsets edgeInsets = UIEdgeInsetsMake(0, 0, TAB_BAR_HEIGHT, 0);    
[imageScrollView setScrollIndicatorInsets:edgeInsets];

So,

  • Is it common to have to manually deduct the tab bar height from a view (whether this be by reducing the size of subviews or the View NIB in inspector)?
  • Is there a way that I can tell a NIB's view loaded from a tab bar to resize itself automatically to NOT sit behind the tab bar?

Cheers

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiscrollview