Jerry
Jerry

Reputation: 11

show always a uiimage on the top of a tabbar

i searched before post my question, but i find nothing useful.

before: i'm a c# developer and i'm doing my first iphone app, don't kill me please!

in my app i have a tabbar controller on the bottom (4 buttons) each button, is a navigation controller type, its show a navigation bar on the top and in the middle i have a viewcontroller (normally after i load an uitableview)

the mad person that asked me to do this app wants that in the top of the TabBar to show always an image (for advertisement, fixed as 320x50).

so the app should look in this way

< NavigationBar >

ViewController

< UIImage >

< TabBar >

but now is

< NavigationBar >

ViewController

< TabBar >

Upvotes: 0

Views: 468

Answers (1)

Emon
Emon

Reputation: 958

at first take tabbarview controller then make view controller then set the UIimage then set the navigation bar for the uiview controller

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

i think it will help you some way...

Upvotes: 0

Related Questions