【问题标题】:Three20 UITableViewCellStyleValue1Three20 UITableViewCellStyleValue1
【发布时间】:2024-01-01 02:40:01
【问题描述】:

如何使用 UITableViewCellStyleValue1 单元格在我的数据源中创建项目?我是否必须创建自己的自定义单元格才能做到这一点?我在示例目录中看不到任何内容。

谢谢, 豪伊

【问题讨论】:

    标签: datasource three20 cell uitableview


    【解决方案1】:

    使用 UITableViewCellStyleValue1 的重点是您使用的是预定义的布局,所以不,您不使用自定义布局。

    例子:

    // Customize the appearance of table view cells.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
        static NSString *CellIdentifier = @"Cell";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if (cell == nil) {
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
        }
    
        // Configure the cell.
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
        cell.textLabel.text = @"SettingLabel";
        cell.detailTextLabel.text = @"SettingValue";
    
        return cell;
    }
    

    【讨论】:

      【解决方案2】:

      添加了一个模拟表格设置单元格样式的新表格项单元格。见https://github.com/facebook/three20/pull/682

      您可以手动合并它,也可以等待下一个希望包含此更改的 three20 版本。

      【讨论】: