我获取了一个包含日历图像和默认标签为2019的单元格的xib文件。现在,我在视图控制器中弹出了一个包含月度和每周选项的弹出窗口。我想从弹出窗口中选择时将单元格中的标签更改为每月或每周,并且导航栏中还有一个重置按钮,当我按下该按钮时,应该再次将单元格中的标签设置为2019
我的cellforrow代码:
if indexPath.section == 0
{
let cell = tableView.dequeueReusableCell(withIdentifier: "DetailsVCLineChartCell", for: indexPath) as! DetailsVCLineChartCell
if self.graphItem == 30
{
cell.lbl_title.text = "Ricavi Totali"
}
else if self.graphItem == 82
{
cell.lbl_title.text = "EBITDAR"
}
else if self.graphItem == 86
{
cell.lbl_title.text = "EBITDA"
}
else
{
cell.lbl_title.text = "Costi Totali"
}
cell.dollars1.removeAll()
cell.dollars2.removeAll()
cell.months.removeAll()
for i in 0..<self.HotelGraph1Budget.count
{
let val = self.HotelGraph1Budget[i].value!
let Dval: Double = (self.removeSpecialCharsFromString(text: val) as NSString).doubleValue
cell.dollars1.append(Dval)
let val1 = self.HotelGraph1Forecast[i].value!
let Dval1: Double = (self.removeSpecialCharsFromString(text: val1) as NSString).doubleValue
cell.dollars2.append(Dval1)
cell.months.append(self.HotelGraph1Forecast[i].month!)
}
cell.btn_filter.addTarget(self, action: #selector(self.click_filter), for: .touchUpInside)
cell.calendarFilter.addTarget(self, action: #selector(self.click_calendar), for: .touchUpInside)
cell.setdata()
return cell
弹出代码:
@IBAction func tap_monthly(_ sender: UIButton) {
self.img_monthly.image = UIImage(named: "radio_checked")
self.img_weekly.image = UIImage(named: "radio_unchecked")
self.changePopupFilterImageColor()
self.calendar_popup.removeFromSuperview()
}
@IBAction func tap_weekly(_ sender: UIButton) {
self.img_weekly.image = UIImage(named: "radio_checked")
self.img_monthly.image = UIImage(named: "radio_unchecked")
self.changePopupFilterImageColor()
self.calendar_popup.removeFromSuperview()
}