How to show tabbar icon full size in iPhone SDK?

2019-08-26 00:06发布

问题:

How to show image icon of tabbar in full size like in this image you can see.

This is my image here you can't see the image is going to be not perfect

How to show my image looks like the above image show I have used for showing image this code navigationController2.tabBarItem.image = [UIImage imageNamed:@"camera_btn"];

Hey I have found the solution for that but I can't know how to change the tabbar controllers view and i can't make my camera button like they do here I am creating tabbar controller from AppDelegate.m file like this

self.tabbarController = [[[UITabBarController alloc] init] autorelease];
self.tabbarController.viewControllers = [NSArray arrayWithObjects:navigationController1,     navigationController2, navigationController3, nil];

This gives me output as in second image I have shown but from example and the code that I have seen from here raised tabbar icons

I have to used this code but it doesn't give me exact result as i want and i think it is not going to change the views also please help me.

self.tabbarController.viewControllers = [NSArray arrayWithObjects:
                    [self viewControllerWithTabTitle:@"Feed" image:[UIImage imageNamed:@"112-group.png"]],
                    [self viewControllerWithTabTitle:@"Popular" image:[UIImage imageNamed:@"29-heart.png"]],
                    [self viewControllerWithTabTitle:@"Share" image:nil],
                    [self viewControllerWithTabTitle:@"News" image:[UIImage imageNamed:@"news.png"]],
                    [self viewControllerWithTabTitle:@"@user" image:[UIImage imageNamed:@"123-id-card.png"]], nil];

i have also add this code for creating center button in appdelegate.m

-(void)willAppearIn:(UIWindow *)navigationController
{
    [self addCenterButtonWithImage:[UIImage imageNamed:@"cameraTabBarItem.png"] highlightImage:nil];
}

回答1:

Make your images the correct size 30x30 e.g. tab1icon.png and 60x60 tab1icon@2x.png



回答2:

You'll have to build your own version of the uitabbar (or use an open source). Because the normal UITabbar leaves space for the text label, even when it is empty.