2012-04-26 61 views
20

enter image description hereXcode:如何在iOS5故事板中添加新標籤頁?

我有這個.. 如何使用iOS5的故事板,讓「客戶」可以有3個屏幕增加另一個標籤屏幕。

賬戶--->帳戶清單--->賬戶詳情

+0

你可以有一個帶3個按鈕的工具欄,每個都有獨立的視圖 – vishy 2012-04-26 13:19:03

+0

使用分頁滾動視圖怎麼樣? – Dani 2012-04-26 13:19:38

+0

@Vishy,已經有4個選項卡,但我想要2個額外的查看屏幕帳戶選項卡。 – 001 2012-04-26 13:48:47

回答

3

這是可以做到編程

// Tab Controller 
UITabBarController *tabBarController = [[UITabBarController alloc]init]; 

// Views to be accessed 
UIViewController *controllerOne = [[UIViewController alloc]init]; 
UIViewController *controllerTwo = [[UIViewController alloc]init]; 
UIViewController *controllerThree = [[UIViewController alloc]init]; 

// Store UIViewControllers in array 
NSArray* screenControllers = [NSArray arrayWithObjects:controllerOne, controllerTwo, controllerThree, nil]; 

// Add Views to Controller 
tabBarController.viewControllers = screenControllers; 

或者使用的InterfaceBuilder

  • 添加'Tab Bar Items'到左側面板的視圖層次結構

    enter image description here

或者使用故事板

iOS Storyboards(向下滾動/搜索 '只是將它加入到我的標籤')

+0

我建議你使用編程方法。還有其他的編程方法可以做到這一點,我肯定會推薦他們使用InterfaceBuilder完成這項任務。做一些你喜歡哪種方法的研究。 – Tim 2012-04-26 13:26:22

+1

你如何在iOS5故事板中做到這一點? – 001 2012-04-26 13:26:57

+0

查看我已編輯的答案,已添加指向其他資源的鏈接 – Tim 2012-04-26 13:31:02

50

您在新的首次下降ViewController,然後按住Ctrl鍵並從Tab Bar Controller拖動到該新控制器。

這會彈出一個窗口,您可以選擇「添加關係Segue」。這將其連接爲第三個選項卡。

+0

要添加到上述答案 - 當您將其添加到Storyboard中時,可能需要通過故事板添加圖像(甚至作爲佔位符)。如果您未添加圖片,底部欄可能會變成「灰色」,並可能在Storyboard中查看時隱藏其他標籤圖片... – goggelj 2016-07-11 10:13:52