2011-09-13 18 views

回答

1

當然,你可以做到這一點,但你有效地滾動你自己的UITabBarController。如果您尚未閱讀,請閱讀class reference。如果這是您想要的,您可以將標籤欄放在屏幕的頂部。看到這個question

如果您仍想使用導航欄創建您自己的版本,請不要使用UINavigationController。相反,您可以使用帶有導航欄的UIViewController子類和UISegmentedControl。 UICatalog示例代碼項目演示瞭如何實現這一點。

在IBAction爲你分段控制

然後,做這樣的事情:

- (IBAction)segmentChanged:(id)sender { 

int selectedIndex = [sender selectedSegmentIndex]; 

switch (selectedIndex) { 
    case 0: 
     NSLog(@"segment 0 selected"); 
     //perform transition and switch views here 
     break; 
    case 1: 
     NSLog(@"segment 1 selected"); 
     //perform transition and switch views here 
     break; 
    case 2: 
     NSLog(@"segment 2 selected"); 
     //perform transition and switch views here 
     break; 
    default: 
     break; 
} 
} 
相關問題