0

I have used UITabBarController in my application.

I am really confuse about what image size should be there for UITabBar. It must support all devices. iPhone 4s,5,5s,5c,6,6 plus.

Sometimes it's create space between tabs. If I change image size then sometimes it looks blur.

I have put normal image,@2x and also @3x.

@3x - 312*180

@2x - 160*120

normal - 80*56

So as per my understanding iPhone 6 should take @2x image but it's not taking it. There is space between tabs in iPhone 6. So I programmatically set images for iPhone 6 and give it's size as 93*56. Then spaces between tabs has been removed and set properly. But now what problem I am facing. Images looks blur in iPhone 6. Don't know what to do now.

Can anybody please help me out here? How can I manage images of tabs which supports all devices. Thanks in advance!

enter image description here Here is my code,

- (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
    // Override point for customization after application launch.

    UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    UITabBarController *tabController = [[UITabBarController alloc]init];

    UINavigationController *navController1 = [[UINavigationController alloc]initWithRootViewController:[storyBoard instantiateViewControllerWithIdentifier:@"ViewController1"]];

    UINavigationController *navController2 = [[UINavigationController alloc]initWithRootViewController:[storyBoard instantiateViewControllerWithIdentifier:@"ViewController2"]];

    UINavigationController *navController3 = [[UINavigationController alloc]initWithRootViewController:[storyBoard instantiateViewControllerWithIdentifier:@"ViewController3"]];

    UINavigationController *navController4 = [[UINavigationController alloc]initWithRootViewController:[storyBoard instantiateViewControllerWithIdentifier:@"ViewController4"]];

    tabController.viewControllers = [NSArray arrayWithObjects:navController1, navController2, navController3, navController4, nil];


    [[[tabController.viewControllers objectAtIndex:0] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"chords-active1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"chords1.png"]];

    [[[tabController.viewControllers objectAtIndex:2] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"progression-active1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"progression1.png"]];

    [[[tabController.viewControllers objectAtIndex:1] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"practice-selected.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"practice.png"]];

    [[[tabController.viewControllers objectAtIndex:3] tabBarItem]setFinishedSelectedImage:[UIImage imageNamed:@"settings-active1.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"settings1.png"]];

    self.window.rootViewController = tabController;

    return YES;
}
iGatiTech
  • 2,306
  • 1
  • 21
  • 45
  • This link helps you : http://stackoverflow.com/questions/25781422/image-resolution-for-new-iphone-6-and-6-3x-support-added?answertab=votes#tab-top – Yuyutsu Apr 29 '15 at 06:36

2 Answers2

2

Follow this IconMatrix Guide provided by Apple. You will get everything..

Nilesh Patel
  • 6,318
  • 1
  • 26
  • 40