2011-03-29 57 views
0

我之前搜索過我的問題,但我發現沒有用。總是顯示一個標籤欄頂部的圖像

之前:我是一個C#開發人員,我正在做我的第一個iPhone應用程序,請不要殺了我!

在我的應用程序我有一個tabbar控制器的底部(4按鈕) 每個按鈕,是一個導航控制器類型,它顯示導航欄的頂部和中間我有一個viewcontroller(通常在我加載一個可用視圖)

要求我做這個應用程序的瘋狂的人希望在TabBar的頂部總是顯示一個圖像(廣告,固定爲320x50)。

因此應用程序應該是這樣

<導航欄>

的ViewController

<的UIImage>

<的TabBar>

但現在

<導航欄>

的ViewController

<的TabBar>

+0

最簡單的方法做t他將通過界面構建​​器。只需拖出一個UIImageView並將其框架和位置設置爲您需要的大小即可。 – Jamie 2011-03-30 00:41:41

+0

您可以嘗試在窗口中添加UIImageView。即你有tabbar控制器的應用程序的主屏幕。 – 2011-03-30 03:51:47

回答

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

導航欄我認爲這會幫助你...