在tabbar的顶部始终显示uiimage

时间:2011-03-29 23:45:27

标签: iphone xcode uiview uiimage uitabbar

我在发布我的问题之前搜索过,但我发现没有任何用处。

之前:我是一个c#开发者,我正在做我的第一个iphone应用程序,请不要杀了我!

在我的应用程序中,底部有一个标签栏控制器(4个按钮) 每个按钮,是一个导航控制器类型,它在顶部和中间显示导航栏我有一个viewcontroller(通常在我加载uitableview后)

要求我做这个应用程序的疯狂的人想要在TabBar的顶部显示一个图像(广告,固定为320x50)。

所以app应该以这种方式看待

< NavigationBar>

的ViewController

< UIImage>

< TabBar>

但现在是

< NavigationBar>

的ViewController

< TabBar>

1 个答案:

答案 0 :(得分:0)

首先使用tabbarview控制器,然后创建视图控制器,然后设置UIimage,然后设置uiview控制器的导航栏

NSMutableArray *listOfViewControllers = [[NSMutableArray alloc] init];

        dashBoardView = [[DashboardViewController alloc] initWithNibName:@"DashboardViewController" bundle:nil];
        dashBoardView.title = @"dashBoardView";
        UINavigationController *mydashboarController = [[[UINavigationController alloc] initWithRootViewController:dashBoardView] autorelease];
        mydashboarController.navigationBar.barStyle = UIBarStyleBlack;
        [listOfViewControllers addObject:mydashboarController];
        [dashBoardView release];

        ordersView = [[OrdersViewController alloc] initWithNibName:@"OrdersViewController" bundle:nil];
        ordersView.title = @"ordersView";
        UINavigationController *myorderController = [[[UINavigationController alloc] initWithRootViewController:ordersView] autorelease];
        myorderController.navigationBar.barStyle = UIBarStyleBlack;
        [listOfViewControllers addObject:myorderController];
        [ordersView release];

        orderList = [[OrderListViewController alloc] initWithNibName:@"OrderListViewController" bundle:nil];
        orderList.title = @"orderList";
        UINavigationController *myorderListController = [[[UINavigationController alloc] initWithRootViewController:orderList] autorelease];
        myorderListController.navigationBar.barStyle = UIBarStyleBlack;
        [listOfViewControllers addObject:myorderListController];
        [orderList release];


        [self.tabBarController setViewControllers:listOfViewControllers animated:YES];

我认为它会对你有所帮助...