2016-07-20 5 views
0

셀을 일부 데이터로 채우는 테이블 뷰를 만들었습니다.스크롤 후 테이블 뷰 셀이 혼합됩니다 (신속한)

문제는 내가 테이블을 스크롤 할 때 모든 셀이 섞여서 멈추는 방법을 알고 있습니까?

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 
    let celda = tabla_reportes.dequeueReusableCellWithIdentifier("celda", forIndexPath: indexPath) as! celdaReportes 
    switch indexPath.section { 
    case 0: 
     celda.datos = tipos 
     celda.back = UIColor.lightGrayColor() 
    case 1: 
     celda.index = indexPath.row 
     celda.datos = fillArrayWithData(datos[indexPath.row] as! NSDictionary) 
     celda.back = UIColor.clearColor() 
    default: 
     break 
    } 
    celda.delegate = self 
    return celda 
} 

답변

0

셀은 성능을 위해 재사용되기 때문에. 예를 들어, 테이블 뷰를 위로 스크롤하고 숫자 1 셀이 사라지면 숫자 10 셀이 실제로 숫자 1 셀입니다. 숫자 1의 셀에 설정 한 값이 업데이트되지 않으면 숫자 10의 셀로 유지됩니다. 값이없는 셀에 빈 값을 넣으십시오.