【问题标题】:I want to use tableview with multiple cells, once cell with multiple columns and 2 cells with one column only我想使用带有多个单元格的表格视图,一个单元格有多个列,2 个单元格只有一列
【发布时间】:2017-01-28 10:52:15
【问题描述】:

我有一个表格视图,其中有 3 个单独的单元格,两个单元格一列,一个单元格两列。 对于 tableview 单元格中具有 2 个图像的单元格,indexPath 应该更改。 任何帮助将不胜感激。

【问题讨论】:

    标签: objective-c uitableview tableview custom-cell


    【解决方案1】:
    You can use this code to shoe differnt cells:- 
    
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    {
        if indexPath.row = 0   // First Cell  
         {
                    let cell = tableView.dequeueReusableCellWithIdentifier(“YourCell”, forIndexPath: indexPath) as! YourCell
                return cell
         }
         else if indexPath.row = 1  // Second Cell 
         {
                let cell = tableView.dequeueReusableCellWithIdentifier(“YourCellWithTwoImages”, forIndexPath: indexPath) as! YourCellWithTwoImages
                return cell
       }
        // Add Condtions for cells 
    }
    

    【讨论】:

      猜你喜欢
      • 2013-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多