0

テンプレートからタブ バー ベースのアプリケーションを選択しました。そのため、以下のように試したカスタム画像を設定する必要があります

 UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UINavigationController *view1=[[UINavigationController alloc]initWithRootViewController:viewController1];

UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
UINavigationController *view2=[[UINavigationController alloc]initWithRootViewController:viewController2];

UIViewController *viewController3 = [[[SecondViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil] autorelease];
UINavigationController *view3=[[UINavigationController alloc]initWithRootViewController:viewController3];

UIViewController *viewController4 = [[[SecondViewController alloc] initWithNibName:@"MainViewController" bundle:nil] autorelease];
UINavigationController *view4=[[UINavigationController alloc]initWithRootViewController:viewController4];


self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.delegate=self;


self.tabBarController.viewControllers = [NSArray arrayWithObjects:view1,view2,view3,view4, nil];

[self.tabBarController.tabBarItem setImage:[UIImage imageNamed:@"h.png"]];

私が試したもう1つの方法

    [[_tabBarController tabBar] setBackgroundImage:[UIImage imageNamed:@"h.png"]];

2番目の方法では画像が適用されますが、それは背景です。

だから私はそのようなホームボタンのようなものを個別に必要とします....

これを設定する方法...ありがとう....

4

2 に答える 2

0

あなたは好きなセットimagesですUIViewControllers's TabBarItems..

viewcontroller1.tabBarItems.image = [UIImage imageNamed:@"your image1"];

viewController2.tabBarItems.image = [UIImage imageNamed:@"your image2"];

viewController3.tabBarItems.image = [UIImage imageNamed:@"your image3"];

viewController3.tabBarItems.image = [UIImage imageNamed:@"your image3"];
于 2012-11-20T08:21:38.257 に答える
0

あなたは次のようにすることができます、

    NSArray *tabs =  tabBarController.viewControllers;
    UIViewController *tab1 = [tabs objectAtIndex:0];
    tab1.tabBarItem.image = [UIImage imageNamed:@"clockicon.png"];
    UIViewController *tab2 = [tabs objectAtIndex:1];
    tab2.tabBarItem.image = [UIImage imageNamed:@"nearest.png"];
于 2012-11-20T08:22:15.507 に答える