Add segmented control to navigation bar and keep title with buttons

后端 未结 8 2582
借酒劲吻你
借酒劲吻你 2020-12-04 10:03

I want to add segmented control to the navigation bar but also keep the title and buttons, like in iOS 7 Appstore purchased section (example)

I have tried adding seg

8条回答
  •  失恋的感觉
    2020-12-04 10:47

    Try to create UINavigationBar subclass and let it conform to UIToolbarDelegate protocol. Then in -init method create your segment control, add it on UIToolBar and set its delegate to your custom UINavigationBar class. Then write this magic:

    - (UIBarPosition)positionForBar:(id )bar {
        return UIBarPositionTopAttached;
    }
    

    Good luck!

提交回复
热议问题