How to add the UISegmentedControl in UINavigationBar?

前端 未结 6 1362
遥遥无期
遥遥无期 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

    you can custom navigationItem's titleView, like this:

    self.navigationItem.titleView = segmentview
    

    you should not add subview to the navigationbar, for after push or pop UIViewcontroller ,the subview is still exsit on the navigationbar.

提交回复
热议问题