2

i am using UITAbBar in my project i want to change its position from bottom to top of view. what code i have to put for this.

{
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    self.view.backgroundColor = [UIColor whiteColor];
   self.title = @"Welcome";


    _friendviewcontroller = [FriendsViewController new];
    _homeviewcontroller = [HomePageViewController new];
    _notifviewcontroller = [NotificationViewController new];
    _messageviewcontroller = [MessagesViewController new];

    self.tabbarcontroller = [[UITabBarController alloc]init];

    self.viewControllers = [NSArray arrayWithObjects:_homeviewcontroller,_messageviewcontroller,_friendviewcontroller,_notifviewcontroller, nil];

    //UITabBar *tabBar = self.tabBarController.tabBar;
    UITabBarItem *item0 = [self.tabBar.items objectAtIndex:0];
    UITabBarItem *item1 = [self.tabBar.items objectAtIndex:1];
    UITabBarItem *item2 = [self.tabBar.items objectAtIndex:2];
    UITabBarItem *item3 = [self.tabBar.items objectAtIndex:3];
}
  • Create subclass of UITabbarController and give the position what ever you want even you can customize each and every button with different size and style. – Maksud Ali Oct 01 '15 at 09:15
  • You can to do that ,I found this [link](http://stackoverflow.com/a/29580094/3920648) – Telember Oct 26 '15 at 03:37

2 Answers2

1
UITabBarController *tabBarController;
tabBarController = [[UITabBarController alloc]init];

// define a custom frame size for the entire tab bar controller that will be in the
// top of the screen.
CGRect tabBarFrame;
tabBarFrame = CGRectMake(0, 0, 320, 200);
tabBarController.view.frame = tabBarFrame;
-3

It is not possible with UITabBarController. It always stays at bottom.

Shivani Gor
  • 329
  • 1
  • 8