Move Tab Bar to top of screen

后端 未结 4 1081
一个人的身影
一个人的身影 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:28

    I use Tab Bar Controller then I simply change the TabBar position in the Tab Bar Controller in the ViewDidLoad()

    import UIKit
    
    class TabbarViewController: UITabBarController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.tabBar.frame = CGRect(origin: CGPoint(x: 0,y :64), size: CGSize(width: 400, height: 50))
    
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    }
    

    Here is the Screen Short attached of the required result... Tab bar on top in tab bar view conmtroller

    Note: It is in swift 3 you can change the syntax to swift 2.* on your own.

提交回复
热议问题