Move Tab Bar to top of screen

后端 未结 4 1085
一个人的身影
一个人的身影 2020-12-07 03:43

I have a Tab Bar Controller which, as we know, displays the tab bar at the bottom of the screen. I\'m looking for a way to move it to the top. I don\'t think I can use a s

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 04:19

    Try this code in methods "viewDidLayoutSubviews" your UITabBarController

    Swift 2.X

      self.tabbar.frame = CGRectMake(0,0,320,50) //example for iPhone 5
    

    Swift 3.X

      self.tabbar.frame = CGRect(0,0,320,50) //example for iPhone 5
    

    Swift 4.X

      self.tabbar.frame = CGRect( x: 0, y: 0, width: 320, height: 50)  //example for iPhone 5
    

提交回复
热议问题