2013-03-14 42 views
3

看起來UITabBarController在iPad中使用垂直標籤時將標籤數量限制爲8。
但我想顯示9個或更多選項卡。如何添加9個或更多的選項卡到UITabBarController?

首先,我只設置了1到7個選項卡到UITabBarController,
並使用UITabBarController以外的第8個和第9個選項卡作爲以下源代碼。
它顯示9選項卡,但會導致一些問題,如工具欄,旋轉withoug權限左右等。

有什麼方法可以正確顯示9個或更多選項卡嗎?

#define RT_TABMEMU_ITEM_MAX 8 
#define RT_TABMEMU_ITEM_MAX_WITH_MORE 7 

- (void)setSelectedViewController:(UIViewController *)selectedViewController { 
    ... 

// If the amount of viewController is less than 9, 
// or index of selectedViewController is 0~6, 
// set selectedViewController to UITabBarController 
    if (!(RT_TABMEMU_ITEM_MAX < [self.viewControllers count] 
      && RT_TABMEMU_ITEM_MAX_WITH_MORE <= [self.viewControllers indexOfObject:selectedViewController])) { 
     [super setSelectedViewController:selectedViewController]; 
    } 

    ... 
} 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    UIViewController *selectedController = (self.viewControllers)[indexPath.row]; 

    if (self.selectedViewController != selectedController) { 
     [self setSelectedViewController:selectedController]; 

    ... 

回答

1

我建議你試試InfiniTabBar for iOS開源項目。有了它,你可以添加儘可能多的標籤,只要你喜歡。我已經在我自己的一個項目中使用它,它非常好!

一切順利!

它是根據PUBLIC LICENSE或作者說許可證發佈:

與往常一樣,我的所有的源代碼可以使用免版稅到您的應用程序。只要確保您不會從源代碼中刪除版權聲明,前提是您將應用程序開源。您不必在您的應用中歸因於我,儘管如果您這樣做,我會很高興。

+0

謝謝!看起來不錯的項目..我嘗試使用它。 – Kazuya 2013-03-15 01:28:50

相關問題