【问题标题】:Programmatically create a grouped-style UITableView以编程方式创建分组样式的 UITableView
【发布时间】:2012-08-08 08:06:47
【问题描述】:

我正在以编程方式创建 tableView,我想设置 tableView 样式组,但如何给 tableView alloc 只有框架我们如何设置这些值。

【问题讨论】:

标签: ios uitableview


【解决方案1】:

参考以下代码。

UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,your_width,your_height) style:UITableViewStyleGrouped];

【讨论】:

    【解决方案2】:

    您可以通过这种方式以编程方式添加它

    tableView = [[[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460) style:UITableViewStyleGrouped] autorelease];
    tableView.dataSource = self;
    tableView.delegate = self;
    
    [self.view addSubview:tableView];
    

    【讨论】:

      【解决方案3】:

      我不确定,我是否以正确的方式理解了你的问题,但你可以这样构造一个 groupe tableView:

      UITableView* tview = [[UITableView alloc] initWithFrame:yourFrame style:UITableViewStyleGrouped];
      

      【讨论】:

        猜你喜欢
        • 2015-02-25
        • 2013-03-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-03-06
        • 2011-06-08
        • 1970-01-01
        相关资源
        最近更新 更多