Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Move UITabBar to the top of a UITabBarController?

I just finished designing a application that uses a top bar that toggles between three UIViewControllers. My first thought was to use a UITabBarController, since it works very simular.

However, the tabBar is at the bottom and in my PSD, it's at the top. Is there anyway I can change it? I see in the library I can drag in a UITabBar, but I don't know how to get it to change pages from there.

Please help! Coulton

like image 698
iosfreak Avatar asked Jan 24 '26 07:01

iosfreak


1 Answers

Hope the below code helps

UITabBarController *tabC = [[UITabBarController alloc]init];
    tabC.tabBar.frame = CGRectMake(0, 0, 320, 70);

    NSArray *arr = [[NSArray alloc]initWithObjects:firstObj,secObj, nil];

    tabC.viewControllers = arr;

    [self.window addSubview:tabC.view];

Worked fine for me

like image 187
Radix Avatar answered Jan 26 '26 23:01

Radix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!