IOS:如何将UITabbar的位置更改为 View 顶部

标签 ios iphone uitabbar

我正在使用 UITAbBar在我的项目中,我想将其位置从 View 底部更改为顶部。
我必须为此输入什么代码。

{
    [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];
}

最佳答案

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;

关于IOS:如何将UITabbar的位置更改为 View 顶部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32858488/

相关文章:

ios - UISwitch 详细文字在下方

ios - 为 Storyboard本地化添加评论

iphone - UIScrollView以自定义速度scrollRectToVisible

iphone - 您如何使用 Twitter.framework 指导用户将他们的 Twitter 帐户添加到 Twitter 设置?

ios - 以编程方式点击选择 UITabBar View

iPhone:如何构建自己的 TabBar?

ios - automaticallyAdjustsScrollViewInsets 不工作

iphone - 如何从另一个函数调用 id sender 函数?

ios - 如何管理来自 QuickBlox 的推送通知的角标(Badge)计数器?

ios - Swift iOS - 如何使 CollectionView 的单元格大小