Custom UINavigationController UIToolbar subclass

狂风中的少年 提交于 2019-12-13 15:48:57

问题


I need to work with a subclassed UIToolbar in the UINavigationController. I know this can be done via Interface Builder but I need it to be done programatically.

The docs state that the UINavigationController toolbar property is readonly so I'm at a bit of a loss as to how I proceed.

Related:

  • Custom UINavigationController UIToolbar Background Image

回答1:


A new init* method has been available since iOS 5

- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass 
                              toolbarClass:(Class)toolbarClass

Also don't forget

... you are responsible for adding a root view controller before presenting the navigation controller onscreen.



来源:https://stackoverflow.com/questions/15767217/custom-uinavigationcontroller-uitoolbar-subclass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!