如何在iPhone SDK中以全尺寸显示标签栏图标? [英] How to show tabbar icon full size in iPhone SDK?

查看:59
本文介绍了如何在iPhone SDK中以全尺寸显示标签栏图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以全尺寸显示标签栏的图像图标,如您所见.

这是我的图像,在这里您看不到图像不是完美的

如何显示我的图像看起来就像上面的代码所示的代码所示 navigationController2.tabBarItem.image = [UIImage imageNamed:@"camera_btn"];

嘿,我已经找到了解决方案,但是我不知道如何更改标签栏控制器视图,也无法像我在这里那样设置相机按钮,而是通过 AppDelegate.m <创建标签栏控制器./code>这样的文件

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

这给了我输出,如我在第二张图片中所示,但是来自示例以及我从 30x30,例如tab1icon.png和60x60 tab1icon@2x.png

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];
}

解决方案

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

这篇关于如何在iPhone SDK中以全尺寸显示标签栏图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆