insanj
insanj

Reputation: 161

Hidden UITabBar still crops any UIView that's put on top of it

I've been trying to add a UIView (with a UIImageView) as an initial screen when the user launches my application for the first time. However, even after I hide the tab bar, or move its frame out of the screen, the UIView still crops itself as if the tab bar was still there.

Both of these code blocks produced the same result:

[appDelegate.tabBarController.tabBar setFrame:CGRectMake(0,1000,0,0)];
[self setView:InitialView];

and

[appDelegate.tabBarController.tabBar setHidden:YES];
[self setView:InitialView];

Here's a screenshot of the incident in action:

enter image description here

Does anyone know how to fix this problem? I've been puzzling away at this for the past few hours, and I can't seem to do anything about it.

Upvotes: 1

Views: 961

Answers (2)

Vikings
Vikings

Reputation: 2527

Try this reference your App Delegate which should take in account the UITabBarController. Just the UIImageView as a subview, and when you are done just remove it. You'll obviously have to import your AppDelegate.

AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication]delegate];

[imageView addSubview:appDelegate.window];

Upvotes: 0

jmstone617
jmstone617

Reputation: 5707

Presumably you have your view's view controller inside this tab bar controller. As a result, the view controller's view is getting sized appropriately to fit inside the tab bar controller's view. Why don't you just get the frame of the tab bar and adjust the height of your view by the view's current height + the tab bar's height?

As a side note, I am assuming InitialView is a UIView (or subclass) instance. It is standard Object-Oriented Programming convention to name instances of classes with a lower case letter, and then to proceed in camel case, as in initialView. Just an FYI.

Upvotes: 1

Related Questions