UIImage *backGroundImage = [UIImage imageNamed:@"home_detail_head.png"];
backGroundImage = [backGroundImage resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeStretch];
[self.navigationController.navigationBar setBackgroundImage:backGroundImage forBarMetrics:UIBarMetricsDefault];
本文介绍如何使用UIImage创建可拉伸的图片,并将其设置为UINavigationController的navigationBar背景。通过使用resizableImageWithCapInsets方法,可以确保图片在不同尺寸的设备上都能正确显示。

1万+

被折叠的 条评论
为什么被折叠?



