How to put a UISegmentedControl under a NavigationController?

后端 未结 1 1925
借酒劲吻你
借酒劲吻你 2021-01-15 05:17

I was wondering what the best approach in order to have a UISegmentedControl appears just under the a navigationController just like in the AppStore application:

相关标签:
1条回答
  • 2021-01-15 06:14

    I would use UITableView's tableHeaderView property for that. That way it will scroll together with the table view's contents.

    To prevent the bar from scrolling together with the table content, I would make it a sibling view (relative to UITableView) and place it just above the table view. If you choose this approach you will have the following view hierarchy: controller's view holds the toolbar and the table view. Note that you will have to set up the table view and handle row deselection in -viewWillAppear: yourself, duplicating functionality of UITableViewController.

    0 讨论(0)
提交回复
热议问题