0

I'm using a storyboard with a TabBarViewController. The UIViewController of the tabs are embedded in UINavigationViewController. I'm using .png files and added through the attributes inspector to the view. At the size inspector the Image Inset is set "18" for top, bottom, left & right.

If the apps starts the icons are a lot too small. After tapping a tab it changes the size to the desired size.

How can I get the correct size of the icons without tapping it?

Thanks!

Joe
  • 207
  • 1
  • 2
  • 9
  • Do you provide the images in 2 resolutions (normal and @2x for retina) in the xcassets? – zisoft Sep 10 '14 at 09:49
  • No, I just added the .png (64x64) to the file system. Which sizes do I need? I have to use xcassets?! Didn't think about that. How should I do it correctly? – Joe Sep 10 '14 at 10:00

1 Answers1

0

You have to provide your images in 2 resolutions.

If you use xcassets, just drag&drop your images in 1x and in 2x resolution on the placeholders and give it a name.

If you do not use xcassets, provide the 2 files with names:

image.png (normal resolution) and image@2x.png (for retina)

Within your code just use image.png as filename, XCode automatically picks the correct file.

zisoft
  • 22,770
  • 10
  • 62
  • 73
  • Now I'm using two resolutions: 64x64 and 128x128. On one tabbarItemImage with xcassets and on another one without - just with the two names like you wrote. If I don't adjust the size of the images with the size inspector of the UINavigationViewController the size of the images doesn't fit inside the tabBar (too huge). If I adjust the size with the ImageInset (size inspector - UINavigationViewController: all values 18) the icons are a lot to small. Only after I tap another tabBarItem in the tabbar the sizes of the images increase to the correct size. Do you have an idea? – Joe Sep 10 '14 at 13:16
  • According to the recommended [icon and image sizes](https://developer.apple.com/library/ios/documentation/userexperience/conceptual/MobileHIG/IconMatrix.html#//apple_ref/doc/uid/TP40006556-CH27-SW1) a tab bar icon should be 25x25 in standard resolution and 50x50 (@2x) in high resolution. – zisoft Sep 12 '14 at 05:54