세부 단추를 누를 때 세부 정보가 tableView의 모든 셀로 밀어 넣어 지도록하는 중입니다. 지금까지 테이블 뷰의 보이는 셀을 반복하면서이 물마루를 얻었습니다. 각 셀에는 애니메이션으로 슬라이드하는 화면 밖의 세부 레이블이 있습니다. 이는 모습입니다 : 내가 볼을 반복하고 있기 때문에 상세 버튼을 꾸르의 테이블 뷰의 모든 셀에 세부 정보 표시
를 누른 후 상세 버튼
- 프레스드
- 하기 전에 세포, 하단에있는 세포는 세부 사항을 때 scr을 세부 단추를 누른 후 olling. 나는 스크린에 보이지 않는 세포가 기억에 있지 않다는 사실을 알고 있지만 이것에 대한 또 다른 접근법이있을 수 있습니까? 여기에 편집
사용자 프레스 "자세히"버튼을
let animationDuration = 0.4 for cell in myTableView.visibleCells { let cell = cell as! MainCell if !detailView { sender.tintColor = UIColor.gray detailView = true UIView.animate(withDuration: animationDuration, animations: ({ cell.noteLbl.center.x = cell.noteLbl.center.x + 100 })) UIView.animate(withDuration: animationDuration, animations: ({ cell.accessoryLbl.center.x = cell.accessoryLbl.center.x + 100 })) UIView.animate(withDuration: animationDuration, animations: ({ cell.timeLbl.center.x = cell.timeLbl.center.x + 100 })) } else { detailView = false sender.tintColor = UIColor.white UIView.animate(withDuration: animationDuration, animations: ({ cell.noteLbl.center.x = cell.noteLbl.center.x - 100 })) UIView.animate(withDuration: animationDuration, animations: ({ cell.accessoryLbl.center.x = cell.accessoryLbl.center.x - 100 })) UIView.animate(withDuration: animationDuration, animations: ({ cell.timeLbl.center.x = cell.timeLbl.center.x - 100 })) } }
코드가 cellForRowAt에 대한
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "MainCell") as! MainCell let shiftForRow = shifts[indexPath.section][indexPath.row] cell.noteLbl.text = shiftForRow.note cell.dateLbl.text = shiftForRow.date cell.accessoryLbl.text = calcTotalHours(STField: shiftForRow.startingTime!, ETField: shiftForRow.endingTime!, lunchTime: shiftForRow.lunchTime!) cell.timeLbl.text = shiftForRow.startingTime! + " - " + shiftForRow.endingTime! return cell }
- 하기 전에 세포, 하단에있는 세포는 세부 사항을 때 scr을 세부 단추를 누른 후 olling. 나는 스크린에 보이지 않는 세포가 기억에 있지 않다는 사실을 알고 있지만 이것에 대한 또 다른 접근법이있을 수 있습니까? 여기에 편집
저는 두 스크린 샷 사이에 어떤 차이점도 보이지 않으며 "모든 셀"이 의미하는 것조차 명확하지 않습니다. – matt
@matt 두 스크린 샷이 표시되도록 게시물을 업데이트했습니다 (제안 해 주셔서 감사합니다). 두 번째 스크린 샷의 셀에는 왼쪽에있는 세부 정보가 있습니다. 모든 셀에서 버튼을 누르면 모든 셀이 아래로 스크롤 할 때 나타나는 세부 사항을 표시해야한다는 것을 의미합니다. –
관련 코드를 포함하려면 질문을 편집해야합니다. 그러나 현재 'cellForRowAt'를 제대로 구현하지 않았기 때문에 현재 모드를 기반으로 적절한 셀 세부 정보가 표시됩니다. – rmaddy