How to show tabbar icon full size in iPhone SDK?

怎甘沉沦 提交于 2020-01-07 04:03:26

问题


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.



来源:https://stackoverflow.com/questions/10655167/how-to-show-tabbar-icon-full-size-in-iphone-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!