我在 CustomTabBarViewController 中设置标题
@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextTranslateCTM(context, 0.0, self.bounds.size.height);
CGContextScaleCTM(context, 1.0, -1.0);
CGContextDrawImage(context, self.bounds , [UIImage imageNamed:@"capiton_haut.png"].CGImage);
if(UIDeviceOrientationIsLandscape([[UIDevice currentDevice] orientation]))
{
CGContextDrawImage(context, CGRectMake(155, 5, 170, 37), [UIImage imageNamed:@"logo_pages.png"].CGImage);
}
else {
CGContextDrawImage(context, CGRectMake(75, 5, 170, 37), [UIImage imageNamed:@"logo_pages.png"].CGImage);
}
}
@end
@implementation CustomTabBarViewController.....
当我测试时,我看到了标题。在我提交并将 ipa 发送给测试人员后,他们没有错误,但看不到 header 。是黑色的。
谢谢, 拉卢卡
最佳答案
图像在 IPA 内吗?您好像忘记了,或者名称与“capiton_haut.png”不同。
编辑:
不使用类别,而是创建 UINavigationBar 子类来覆盖 drawRect:
方法。这应该可以解决您的问题,并且可以在 iOS 5 上运行。
关于objective-c - 安装 ipa 的人不会出现标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9580541/