Mat Demon
Mat Demon

Reputation: 197

Increase size of UITabbar

I need to subclass a UITabBar and increase its size.

I made it with code

 -(CGSize)sizeThatFits:(CGSize)size
{
   CGSize sizeThatFits = [super sizeThatFits:size];
   sizeThatFits.height = kTabBarHeight;
   return sizeThatFits;

But this stretches it. How can I increase it without stretching? I need some clear area.

Upvotes: 0

Views: 66

Answers (1)

Parth Patel
Parth Patel

Reputation: 1290

I faced this issue and I was able to solve it. You have to add following code to your subclass of UITabBarController class.

- (void)viewWillLayoutSubviews
{ 
    CGRect tabFrame = self.tabBar.frame; //self.TabBar is IBOutlet of your TabBar
    tabFrame.size.height = 80;
    tabFrame.origin.y = self.view.frame.size.height - 80;
    self.tabBar.frame = tabFrame;
}

Upvotes: 1

Related Questions