UIBarButtonItems not showing up on UIToolbar

2019-05-21 05:08发布

I have a UINavigationController with toolbarHidden set to NO.

I have added UIBarButtonItems to navigationController.toolbar.

The toolbar is displayed, but the buttons are not...

What gives?

1条回答
我命由我不由天
2楼-- · 2019-05-21 05:35

Ok so apparently I misunderstood the usage of the setItems method on navigationController.

To remedy this I set the toolbar items on each view controller that is pushed onto the navigation controller's stack.

I guess if I wanted to have one toolbar persist through all the views I could add a new toolbar to the view controller holding my navigation controller then simply invoke setItems on my navigation controller.

I digress.

查看更多
登录 后发表回答