更新到Xcode 4.2后,我遇到了麻烦。 在我使用下面的代码来制作自定义导航栏之前,但是当我使用iPhone 5.0模拟器时,它失败了,而在iPhone 4.2模拟器中却没有问题。iOS5中的自定义UINavigation栏
我可以知道什么是问题,我该如何解决这个问题?
非常感谢
@implementation UINavigationBar (UINavigationBarCustomDraw)
- (void) drawRect:(CGRect)rect {
[self setTintColor:[UIColor colorWithRed:0.4f
green: 0.0f
blue:0.4f
alpha:1]];
if ([self.topItem.title length] > 0 && ![self.topItem.title isEqualToString:@""])
{
[[UIImage imageNamed:@"purple.jpg"] drawInRect:rect];
}
}
@end