【问题标题】:UITabBarController moreNavigationController as a grouped TableView?UITabBarController moreNavigationController作为一个分组的TableView?
【发布时间】:2011-02-24 22:18:21
【问题描述】:

我使用的 UITabBarController 有超过 5 个项目,因此它显示更多选项卡。

是否可以让这个moreNavigationController成为一个分组的TableView(uitableviewstylegrouped)?目前它默认为普通的表格视图。

【问题讨论】:

  • 也很想知道答案。
  • 你有没有想过这是否可能?
  • @derrichh:不,从来没弄明白。

标签: uitabbarcontroller uitableview


【解决方案1】:

尝试准确地给出 5,而不是超过 5,让第 5 个成为分组表视图控制器的主机

【讨论】:

    【解决方案2】:

    下面的代码 sn-p 正是这样做的。它使用 UITabBarController 的实例(这里称为控制器)通过 UITabBarController moreNavigationController 属性访问导航栏和 tableview 控制器。

    #define BACKGROUNDCOLOUR [UIColor colorWithRed:253.0/255.0 green:255.0/255.0 blue:240.0/255.0 alpha:1.0]
    
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
    {    
        //... other init code
    
        UINavigationBar *moreNavBar = controller.moreNavigationController.navigationBar;
    
        moreNavBar.tintColor = [UIColor blackColor];
    
        UITableView *moreTableView = (UITableView *)controller.moreNavigationController.topViewController.view;
    
        [moreTableView initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        [moreTableView setBackgroundColor:BACKGROUNDCOLOUR];
    
        [self.window addSubview:controller.view];
        [self.window makeKeyAndVisible];
    
        return YES;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-26
      • 2010-11-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多