그래서 각 셀에 대해 높이가 다른 UITableView에 3 개의 다른 tableView 셀을 설정하려고합니다. 각각 고유 한 높이로 3 개의 다른 셀을 반환하는 방법이 궁금합니다.
조언이나 도움에 감사드립니다!
// MARK: - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 3
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if(section == 0) {
return 1
}
if(section == 1) {
return 1
}
else {
return 10
}
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
switch indexPath.section{
case 0:
let myProfile = tableView.dequeueReusableCellWithIdentifier("ProfileHeaderCell") as! VideoTableViewCell
return myProfile
case 1:
let myInfo = tableView.dequeueReusableCellWithIdentifier("AlbumCell") as! AlbumTableViewCell
return myInfo
default:
let cell = tableView.dequeueReusableCellWithIdentifier("TravelBookCell") as! TravelBookTableViewCell
return cell
}
}
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
let section = indexPath.section
if(section == 0) {
return 20
}
if(section == 1) {
return 30
}
else {
return 50
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다