0

In my application when the contact tab is clicked (Middle button), I want to move the UITabBar up from the bottom of the screen and display a view below it.

However when I move the UITabBar up with the following code, the UITabBarItems disappear:

- (void)moveTabBarUpwards
{
    [self.tabBar setFrame:CGRectMake(0, 300, self.view.frame.size.width, self.view.frame.size.height)];
    //[self.tabBar.items[0] setFrame:CGRectMake(0, 300, self.view.frame.size.width, self.view.frame.size.height)];
}

Here is the result:

enter image description here enter image description here

Even though the tabs disappear, the toolbar still functions correctly in the new position. Not sure why this is happening.

Edit

If I move the tab bar right to the top then the UITabBarItems remain in the same place. If I move the y to say 10 I get the following (as you can see, the UITabBarItems are still visible but have move down slightly):

enter image description here

pls
  • 1,522
  • 2
  • 21
  • 41

1 Answers1

2

I doubt that altering iOS' standard UI elements frames directly is a good point at all. Same goes here for UINavigationBar for example.

I'd advise you to create your own model of a UIView with UIButtons and a parent view controller with child VCs as tabs. This way, you'll be 100% safe in future iOS releases, because no one beside Apple really knows which way any given component of iOS is going to go.

Sergey Grischyov
  • 11,995
  • 20
  • 81
  • 120
  • Thanks for the advice SergiusGee. I have gone with creating a view controller that has a container view to house the tab bar selection views. Then I have a view with at the bottom with buttons on for the tab bar itself. – pls Dec 03 '14 at 12:52
  • @pls Glad to be of help! – Sergey Grischyov Dec 04 '14 at 23:18