簡體   English   中英

iOS:如何將UITabbar的位置更改為視圖頂部

[英]IOS: How to change the position of UITabbar to the top of view

我在我的項目中使用UITAbBar ,我想將其位置從底部更改為頂部。 我必須為此輸入什么代碼。

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

使用UITabBarController是不可能的。 它總是停留在底部。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM