Set a custom subclass of UINavigationBar in UINavigationController programmatically

前端 未结 12 1518
清歌不尽
清歌不尽 2020-11-28 17:29

Does anyone know how can I use my custom subclass of UINavigationBar if I instantiate UINavigationController programmatically (without IB)?

<
12条回答
  •  自闭症患者
    2020-11-28 18:16

    One scenario I've found that we need to use subclass rather than category is to set navigationbar backgroundcolor with pattern image, because in iOS5 overwriting drawRect using category does not work any more. If you want to support ios3.1-5.0, the only way you can do is to subclass navigationbar.

提交回复
热议问题