视网膜显示图像问题
我有一个 TabBarController 应用程序,其中第一个 tabBarItem 是 NavigationController...
我使用以下代码以编程方式将图像背景分配给 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.If I try my app in the iPhone 4 simulator, the high definition image isn't loaded correctly and is showed the normal image...
我该如何解决这个错误?使用 colorWithPatternImage 方法的最佳方法是使用具有视图确切大小的图像还是图案图像?
谢谢
I have a TabBarController app where the first tabBarItem is a NavigationController...
I assign programmatically an image background to the navController with this code:
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.
If I try my app in the iPhone 4 simulator, the high definition image isn't loaded correctly and is showed the normal image...
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?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用 UIColor 类的 initWithPatternImage 方法解决了这个问题。
我创建并分配了一个 UIColor 实例,为其分配了一个图像,然后将其与背景一起使用。
希望这可以帮助其他人:)
I solved this problem using initWithPatternImage method of UIColor class.
I created and allocated an UIColor instance, I assigned to it an image and then I used it with background.
Hope this can help other :)