How to add the UISegmentedControl in UINavigationBar?

前端 未结 6 1355
遥遥无期
遥遥无期 2021-02-04 03:44

I have tried to add the UISegmentedControl to the bottom of UINavigationBar with title. But i cannot add it and I cannot add UISegmentedControl

6条回答
  •  一向
    一向 (楼主)
    2021-02-04 04:26

    To put it in the navigationBar has a right left and title view for such things... accessed using....

    self.navigationItem.titleView = mySegmentedControl

    for future reference....

    self.navigationItem.rightBarButtonItem
    self.navigationItem.leftBarButtonItems // for adding an Array of items
    

    To add it below the navigation view but have it static.. add it to the viewController.view... Are you using a UITableViewController? If so maybe switch to a UIViewController and add a tableView then your toolbarview as subviews to that self.view.

提交回复
热议问题