[英]Problem with a Retina Display Image
I have a TabBarController app where the first tabBarItem is a NavigationController... 我有一个TabBarController应用程序,其中第一个tabBarItem是NavigationController ...
I assign programmatically an image background to the navController with this code: 我使用以下代码以编程方式将图像背景分配给navController:
self.navigationController.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"OverviewBg.png"]];
The "OverviewBg.png" image is the exact size of the view between tabBar and NavBar.
How can I solve this mistake? 我该如何解决这个错误? The best way to use colorWithPatternImage method is use an image with the exact size of the view or a pattern image?
使用colorWithPatternImage方法的最佳方法是使用具有正确视图尺寸的图像还是图案图像?
Thanks 谢谢
I solved this problem using initWithPatternImage method of UIColor class. 我使用UIColor类的initWithPatternImage方法解决了此问题。
I created and allocated an UIColor instance, I assigned to it an image and then I used it with background. 我创建并分配了一个UIColor实例,为它分配了图像,然后将其与背景一起使用。
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"OverviewBg.png"]];
self.navigationController.view.backgroundColor = background;
Hope this can help other :) 希望这可以帮助其他:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.