728x90
๐ก๋ฌธ์ ์ํฉ
1. Section1์ ๋ฃ์ด์ค ์ ์์๋๋ก ๊ตฌ๋ถ์ ์ด ์๊ธด๋ค
2. Section2์ Cell ์์ ๊ตฌ๋ถ์ ์ด ์๊ธด๋ค
๐ํด๊ฒฐ๋ฐฉ๋ฒ
[ํ
์ด๋ธ๋ทฐ ๋ณ์๋ช
].separatorStyle = .none
๐ก์ ์ ํด๋ฆญํ ๊ฒฝ์ฐ ๋ฌธ์ ์ํฉ
1. ์ ์ ํด๋ฆญํ์๋ Section1 ๊ตฌ๋ถ์ ์ด ์๊ธด๋ค
๐ํด๊ฒฐ๋ฐฉ๋ฒ
Section์์ Header์ Footer์์ ๊ตฌ๋ถ์ ์ด ์กด์ฌํ๊ธฐ ๋๋ฌธ์ ์๊ธฐ๋๊ฒ!!
[ํ
์ด๋ธ๋ทฐ ์
].selectionStyle = .none
์ ์ฒด ํจ์
/// ์
์ง์
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let remindGoalTitleTVC = remindTV.dequeueReusableCell(withIdentifier: Identifiers.RemindGoalTitleTVC) as? RemindGoalTitleTVC,
let remindFilterTVC = remindTV.dequeueReusableCell(withIdentifier: Identifiers.RemindFilterTVC) as? RemindFilterTVC,
let remindNoGoalTVC = remindTV.dequeueReusableCell(withIdentifier: Identifiers.RemindHaveNoGoalTVC) as? RemindHaveNoGoalTVC,
let remindGoalTVC = remindTV.dequeueReusableCell(withIdentifier: Identifiers.RemindGoalTVC) as? RemindGoalTVC else { return UITableViewCell() }
switch indexPath.section {
case 0:
if goalCount == 0 {
remindGoalTitleTVC.isPrivateImageView.image = UIImage(named: "icEmptyGoal")
remindGoalTitleTVC.goalTitleLabel.setLabel(text: "์์ง ์ถ๊ฐํ ๋ชฉํ๊ฐ ์์ด์", color: .grey_5, size: 18, weight: .bold)
}
return remindGoalTitleTVC
case 1:
/// bottomsheet๋ฅผ ๋์ด์ผํ ๋ ํด๋ก์ ๋ฅผ ์ฌ์ฉํ ์ฝ๋์ด๋ค ( ์ฒซ ๊ฐ์ = 0 , ํ ๊ฐ์ = 1)
/// ๋ฐํ
์ํธ๋ฅผ ์ ํํ์ง ์๊ณ ๋์ฐ๊ธฐ๋ง ํ ๊ฒฝ์ฐ๋ selected๋ฅผ false๋ก ์ฒ๋ฆฌํด์ฃผ์๋ค.
remindFilterTVC.selectFilterAction = { num in
if num == 0 {
self.showFilterHalfModalVC(index: 0)
self.selectedPreviousEmoji = false
} else {
self.showFilterHalfModalVC(index: 1)
self.selectedLatestEmoji = false
}
}
/// ์ด๊ธฐํ๋ฒํผ ์ฒ๋ฆฌ ํด์ฃผ๋ ํด๋ก์
remindFilterTVC.selectResetBtnAction = { check in
if check == true {
self.getPreviousEmoji = ""
self.getLatestEmoji = ""
self.selectedResetBtn = check
self.selectedPreviousEmoji = false
self.selectedLatestEmoji = false
}
}
/// ๋ฐํ
์ํธ์ ๊ฐ ์
๋ ฅ์ด ์๋์์ ๊ฒฝ์ฐ์ด๊ฑฐ๋ ๋ฐํ
์ํธ์ ์ด๋ชจ์ง๋ฅผ ์ ํํ์ง ์๊ณ ๊ป์ ๊ฒฝ์ฐ ๋ถ๊ธฐ์ฒ๋ฆฌ
if (getPreviousEmoji != "" || selectedPreviousEmoji == true) && selectedResetBtn == false {
remindFilterTVC.previousFeelingBtn.setTitleColor(.sub, for: .normal)
remindFilterTVC.previousFeelingBtn.backgroundColor = .pomeMiddlePink
remindFilterTVC.previousFeelingBtn.setTitle(getPreviousEmoji, for: .normal)
remindFilterTVC.previousFeelingBtn.setImage(UIImage(named: "icArrowDown17Pink"), for: .normal)
}
if (getLatestEmoji != "" || selectedLatestEmoji == true) && selectedResetBtn == false {
remindFilterTVC.laterFeelingBtn.setTitleColor(.sub, for: .normal)
remindFilterTVC.laterFeelingBtn.backgroundColor = .pomeMiddlePink
remindFilterTVC.laterFeelingBtn.setTitle(getLatestEmoji, for: .normal)
remindFilterTVC.laterFeelingBtn.tintColor = .sub
remindFilterTVC.laterFeelingBtn.setImage(UIImage(named: "icArrowDown17Pink"), for: .normal)
}
/// ์ด๊ธฐํ๋ฒํผ์ด ๋๋ ธ์๋์ UI์ฒ๋ฆฌ
if selectedResetBtn == true {
[remindFilterTVC.previousFeelingBtn, remindFilterTVC.laterFeelingBtn].forEach {
$0?.backgroundColor = .grey_2
$0?.setTitleColor(.grey_5, for: .normal)
$0?.tintColor = .grey_5
$0?.makeRounded(cornerRadius: 4.adjusted)
$0?.setImage(UIImage(named: "icArrowDown17"), for: .normal)
$0?.semanticContentAttribute = .forceRightToLeft
}
remindFilterTVC.previousFeelingBtn.setTitle("์ฒ์ ๊ฐ์ ", for: .normal)
remindFilterTVC.laterFeelingBtn.setTitle("๋์๋ณธ ๊ฐ์ ", for: .normal)
}
remindFilterTVC.selectionStyle = .none
return remindFilterTVC
case 2:
if goalCount == 0 {
return remindNoGoalTVC
} else {
remindGoalTVC.setData(RemindGoalDataModel.sampleData[indexPath.row])
remindGoalTVC.tapMateEmojiBtnAction = {
self.showMateEmojiHalfModalVC()
}
return remindGoalTVC
}
default:
return UITableViewCell()
}
}
728x90