How to subclass UINavigationBar for a UINavigationController programmatically?

后端 未结 6 469
半阙折子戏
半阙折子戏 2020-11-29 20:00

I\'m using a custom drawRect function to draw on UINavigationBar across my application in iOS4, it doesn\'t use images, only CoreGraphics.

Since you ca

6条回答
  •  醉话见心
    2020-11-29 20:27

    In iOS 6 they added a new method to UINavigationController that is retractively available in iOS 5 as well:

    - (id)initWithNavigationBarClass:(Class)navigationBarClass
                        toolbarClass:(Class)toolbarClass;
    

    Now you can just pass your custom class when the navigation controller is instantiated.

提交回复
热议问题