ios 5.0中关于UINavigationBar, UIToolbar, and UITabBar - drawRect:调用问题

文章详细解释了在iOS5及之后版本中,UINavigationBar、UIToolbar和UITabBar的drawRect:方法的调用规则变化,并提供了在iOS5和之后版本中如何正确实现这些UI组件的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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. Apps can either:

Use the customization API for bars in iOS 5 and later, which is the preferred way.

//原文地址 http://blog.youkuaiyun.com/diyagoanyhacker/article/details/6876543

Subclass UINavigationBar (or the other bar classes) and override drawRect: in the subclass.


通过官方的说法我们可以看出:- drawRect:只有定义在它们的子类中才会被执行.并且ios5 也定义了设置背景的API。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值