굿모닝(SWIFT) 확장 및 축소의 tableview 셀 탭
는 I 내부적 CollectionViewCell 및 방향 화살표를 가진 사용자 TableViewCell을 만들었다. 셀을 확장하고 접을 수있게 만들었지 만 하나의 셀을 확장하고 이전의 축소를 클릭하면됩니다. 예 : 셀이 펼쳐져 있고 셀을 탭하면 셀을 축소하고 동시에 셀을 확장하려고합니다. 그래서 주어진 순간에 오직 하나의 셀만 확장 된 상태가되어 타겟팅 화살표가 변경됩니다.
예 :
셀라가 확대되고 cellB가 도청 경우에, 나는 셀라 수축하고 cellB 동시에 확장합니다. 그래서 주어진 순간에 오직 하나의 셀만 확장 된 상태가되어 목표 화살표를 바꿀 수 있습니다.
내 코드 :
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
switch(selectedIndexPath)
{
case nil:
let cell = myTableView.cellForRow(at: indexPath) as! TableViewCell
cell.arrowImagem.image = UIImage(named:"content_arrow2")
selectedIndexPath = indexPath
default:
if selectedIndexPath! == indexPath
{
let cell = myTableView.cellForRow(at: indexPath) as! TableViewCell
cell.arrowImagem.image = UIImage(named:"content_arrow")
//cell.reloadInputViews()
selectedIndexPath = nil
}
}
self.myTableView.beginUpdates()
self.myTableView.reloadData()
//myTableView.reloadRows(at: [indexPath], with: .automatic)
self.myTableView.endUpdates()
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let index = indexPath
if selectedIndexPath != nil{
if(index == selectedIndexPath)
{
return 147
}
else{
return 67
}
}
else
{
return 67
}
}
미안 내가 beggining 번역 해달라고 질문 중 안녕하세요. 나는 creat 내부적으로 CollectionViewCell과 방향 화살표가있는 사용자 정의 TableViewCell. 셀을 확장하고 접을 수있게 만들었지 만 하나의 셀을 확장하고 이전 축소판을 클릭하면 좋아집니다. 예 : 셀을 확장하고 셀을 탭하면 셀을 축소하고 동시에 셀을 확장해야합니다. 그래서 주어진 순간에 오직 하나의 셀만 확장 된 상태가되어 타겟팅 화살표가 변경됩니다. –
수정하거나 추가해야하는 경우 언제든지 질문을 편집 할 수 있습니다. – Moritz
정보 에릭 주셔서 감사합니다 :) –