1
배열 배열 유형의 문자열 배열을 가지고 루프 내에서 tableView
에 인쇄합니다. cellForRowAt indexPath
: function이지만 아무 것도 없습니다. solution.My 문제 ones.it를 기존의 오래된 것들을 덮어에 tableview
시뮬레이터, 내가 더 파단을 삽입 내 내가 Swift 3 셀 하위 뷰를 제거하면 UITableView 셀 분리자가 사라짐
for view in cell.subviews {
view.removeFromSuperview()
}
를 사용 방지하기 위해 움직일 때마다이지만 내 나이가 셀 라벨 내 휴대 seperators을 삭제합니다. 분리기가 아닌 셀 데이터 만 제거하려면 어떻게해야합니까?
func tableView(_ tableView: UITableView, cellForRowAt indexPath:IndexPath) -> UITableViewCell {
var cell:UITableViewCell = tableView.dequeueReusableCell(withIdentifier: "cell")! as UITableViewCell
//print(cell.subviews)
for view in cell.subviews {
view.removeFromSuperview()
}
for i in 0..<globalHeaderStructArray.count{
var newLabel = UILabel(frame: CGRect(x:xCoordination, y:10, width:Double(globalHeaderStructArray[i].width)!, height:30.0))
newLabel.font = UIFont(name: "Avenir", size: 17.0)
newLabel.textColor = UIColor.darkGray
newLabel.text = "\(globalDataArray[indexPath.row][i])"
var scrollview = UIScrollView(frame: cell.bounds)
scrollview.contentSize = CGSize(width:cell.bounds.width * 5, height:cell.bounds.height) // will be 5 times as wide as the cell
scrollview.isPagingEnabled = true
cell.contentView.addSubview(scrollview)
cell.addSubview(newLabel)
xCoordination += Double(globalHeaderStructArray[i].width)!
}
xCoordination = 0.0
return cell
}
100 % 절대적으로 필요한 경우가 아니면 모호한 태그의 사용을 권장하지 않습니까? (레거시 아키텍처 문제로 인해 매우 드물고 일반적으로 잘못됨)? 참조가 필요한 경우 포인터를 사용하십시오 ..... – TheCodingArt