UINavigationBar's drawRect is not called in iOS 5.0

后端 未结 7 1849
清歌不尽
清歌不尽 2020-11-28 07:59

I\'ve overrided(placed in category, or swizzled) UINavigationBar\'s drawRect to show custom background. In iOS 5 it\'s not working. What should I do?

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 08:07

    Try to read iOS 5.0 Release Notes

    In iOS 5, the UINavigationBar, UIToolbar, and UITabBar implementations have changed so that the drawRect: method is not called unless it is implemented in a subclass. Apps that have re-implemented drawRect: in a category on any of these classes will find that the drawRect: method isn't called. UIKit does link-checking to keep the method from being called in apps linked before iOS 5 but does not support this design on iOS 5 or later.

提交回复
热议问题