tableViewCell
에서 뷰의 배경색을 변경하려고하지만 첫 번째로드에서는 변경되지 않으며 변경 사항을 보려면 스크롤해야합니다. break
이 스위치를 종료합니다 의미로,테이블 뷰 셀에서 뷰의 색상 변경이 이루어지지 않습니다.
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "MealCell"
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! ReservationCell
let reservation = filteredreservations[(indexPath as NSIndexPath).row]
cell.name_label.text = "نام: "+reservation.client_name
cell.name_label.font = UIFont(name: "WeblogmaYekan", size: 17)
cell.time_label.text="زمان: "+reservation.ft_of_time+"-"+reservation.ft_to_time
cell.time_label.font = UIFont(name: "B Yekan", size: 17)
cell.res_date.text="تاریخ: \(reservation.date)"
cell.res_date.font = UIFont(name: "B Yekan", size: 17)
var status = ""
if reservation.type {
cell.node_label.text="ex1 \(reservation.node_title)"
} else {
cell.node_label.text="ex2"
}
switch reservation.res_status {
case "CanceledByAdmin":
cell.status_back.backgroundColor=Utils.UIColorFromRGB(rgbValue: 0xFFFC635D)
status = "ex"
case "Canceled":
cell.status_back.backgroundColor=Utils.UIColorFromRGB(rgbValue: 0xFFEE903D)
status = "ex"
case "Deprecated":
cell.status_back.backgroundColor=Utils.UIColorFromRGB(rgbValue: 0xFF757575)
status = "ex"
default:
cell.status_back.backgroundColor=Utils.UIColorFromRGB(rgbValue: 0xFF3BA757)
status = "ex"
}
cell.status_label.text=status
cell.status_label.font = UIFont(name: "WeblogmaYekan", size: 17)
return cell
}
는'cellForRowAtIndexPath' 내부 코드가 작동? –
예 @NiravD –