gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 17:06:02 26 4
gpt4 key购买 nike

我正在使用 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com