How to support different tab icon sizes in iOS 7 and iOS 6?

In iOS 7, Apple increased the standard size of the tab bar icons. If the tab bar icons are set in the storyboard, how can you simultaneously support both iOS 6 and iOS 7 interfaces? Need to make a separate storyboard for iOS 7?

Programmatically customize the icon if you are on iOS 7?

I am mostly confused because there is nothing in the documentation about icons of different sizes for tabs ( https://developer.apple.com/library/ios/documentation/userexperience/conceptual/TransitionGuide/TransitionGuide.pdf p. 26)

In fact, the icons look almost identical.

But when I launch my application in iOS 7, all the icons are reduced.

+4
source share
2 answers

You can use the following method to check the version of current iOS, and then adjust the button size and appearance of the buttons on the navigation bar.

 if (floor(NSFoundationVersionNumber)<=NSFoundationVersionNumber_iOS_6_1) {
        UIImage *navBarImage=[[UIImage imageNamed:@"top-bar-bg-44px.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
        [[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];

        UIImage *barButtonImg=[[UIImage imageNamed:@"back-ios6.png"]
            resizableImageWithCapInsets:UIEdgeInsetsMake(0, 13, 0, 5)];

        [[UIBarButtonItem appearance] setBackButtonBackgroundImage:barButtonImg forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
    }

    else{


}
0
source

After some digging, I found the answer here - Toolbar icons on the retina screen

“You need to create two separate icons icon.png (30x30) and icon@2x.png (60x60). IOS will automatically download the desired file based on the screen scale.

0
source

All Articles