Positioning UITabBar at the top

前端 未结 9 1778
小鲜肉
小鲜肉 2020-11-28 10:30

I\'m a beginner in iOS development. My question is: is it possible to position UITabBar at the top and how? I can\'t position my UITabBar at the top of the view.

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 11:08

    You can create a custom tab bar by making it yourself, but apple highly discourages mimicking a system control for a function it was not originally intended to do.

    Once again, I discourage you to do so, because it violates the consistency of your app and system apps. But since I'm at it, here we go:

    For a custom tab bar, you need to create a view that holds multiple buttons. You also need a container view below the UITabBar (because you want the UITabBar to be at the top). When a button is pressed, you change the UIViewController inside the container.
    Its quite simple, but of course, its strongly not recommended.

提交回复
热议问题