Note that there are some explanatory texts on larger screens.

plurals
  1. POHigh-res UITabBar icons display at full size on low-res screen
    text
    copied!<p>I'm in the process of upgrading my iPhone app to high-res graphics, and I've run into some problems with older devices. The situation involves my UITabBar icons. Have a look:</p> <p><img src="https://i.stack.imgur.com/T8rhl.png" alt="alt text"></p> <p>The top screenshot looks correct. It was captured on the latest generation iPhone (new screen) running OS4. However, the second screenshot is completely wrong. The high-res icons are displaying at 100% size and are getting cropped. That second screenshot was taken from my second-gen iPod touch (old screen) running OS4.</p> <p>So, I'm really confused here. I've read over Apple's documentation, and as far as I know I'm doing everything they require. Within my app bundle I have images named as:</p> <ul> <li>tab-featured.png</li> <li>tab-featured@2x.png</li> <li>tab-topics.png</li> <li>tab-topics@2x.png</li> <li>(...etc...)</li> </ul> <p>Within interface builder, I have specified the low-res version of each image (the filename WITHOUT "@2x") to be used in the tab bar. If I understand iPhone documentation correctly, the device should automatically detect screen resolution and display the high-res version if available. So if anything, it almost seems like my iPod touch is incorrectly detecting its display resolution. Am I missing something here perhaps?</p> <p>Any help or insight that can be offered would be appreciated! Thanks.</p> <p><strong>Update 1:</strong></p> <p>No luck so far. I took the manual approach and added the following into the <code>viewDidLoad</code> command of my <code>UITabBarController</code>:</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; UITabBarItem *tab; UIViewController *item; tab = [[UITabBarItem alloc] initWithTitle:@"Featured" image:[UIImage imageNamed:@"tab-featured.png"] tag:0]; item = [self.viewControllers objectAtIndex:0]; item.tabBarItem = tab; [tab release]; tab = [[UITabBarItem alloc] initWithTitle:@"Topics" image:[UIImage imageNamed:@"tab-topics.png"] tag:1]; item = [self.viewControllers objectAtIndex:1]; item.tabBarItem = tab; [tab release]; tab = [[UITabBarItem alloc] initWithTitle:@"Video" image:[UIImage imageNamed:@"tab-video.png"] tag:2]; item = [self.viewControllers objectAtIndex:2]; item.tabBarItem = tab; [tab release]; tab = [[UITabBarItem alloc] initWithTitle:@"Experts" image:[UIImage imageNamed:@"tab-experts.png"] tag:3]; item = [self.viewControllers objectAtIndex:3]; item.tabBarItem = tab; [tab release]; tab = [[UITabBarItem alloc] initWithTitle:@"Events" image:[UIImage imageNamed:@"tab-events.png"] tag:4]; item = [self.viewControllers objectAtIndex:4]; item.tabBarItem = tab; [tab release]; } </code></pre> <p>This still produces the same result as above (large cut-off icons within the tab bar). Has anyone heard of issues with the UITabBar populating high-res icon pairs?</p> <p><strong>Update 2:</strong></p> <p>Regarding James' comment:</p> <p>Yes, I was able to resolve this. It seemed to be an error with file references in XCode. I was running out of ideas, so I rolled back and started stripping out all @2x images from my app, just to get everything displaying correctly again with the low-res artwork. Once the app displayed proper size images again (albeit at low-resolution), then one by one I started adding the @2x images back in, waiting for something to break. It seemed to work fine the second time going in. Don't know why or what happened. The SDK just seemed to get some wires crossed as to what had happened.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload