1

在此处输入图像描述

如果我正在设置导航栏背景图像,它在应用程序中可以正常工作,但如果我从我的邮件编辑器打开这个屏幕,它会中断。谁能告诉我这段代码有什么问题?

UIImage *gradientImage44 = [[UIImage imageNamed:@"image.png"]
                                    resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UINavigationBar appearance] setBackgroundImage:gradientImage44 
                                           forBarMetrics:UIBarMetricsDefault];

@implementation UINavigationBar (CustomBackground)

- (void)drawRect:(CGRect)rect
{
    UIImage *navBackgroundImage = [[UIImage imageNamed:@"image.png"] stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0];
    [navBackgroundImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
}

@end
4

0 回答 0