2017-01-28 11 views
0

У меня есть табличное представление, в котором есть 3 отдельных ячейки, две ячейки с одним столбцом и ячейка с двумя столбцами. IndexPath должен измениться для ячеек, имеющих 2 изображения в ячейке tableview. Любая помощь будет оценена по достоинству.Я хочу использовать tableview с несколькими ячейками, как только ячейка с несколькими столбцами и 2 ячейки с одним столбцом

first cell with one column

cell 2 with 2 columns

ответ

0
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 
}