如何在swift 3.x中的FSCalendar中选择日期时更改图像?

时间:2017-09-02 07:46:14

标签: ios swift3 fscalendar

用于设置我正在做的图像

func calendar(_ calendar: FSCalendar, imageFor date: Date) ->     
      UIImage? {
    let day: Int! = self.gregorian.component(.day, from: date)
    if day == 6 || day == 10{
        return UIImage(named: "event_calender")
    }else if day == 7 || day == 14{
        return UIImage(named: "holiday_calender_line")
    }
    else if day == 7 || day == 14{
        return UIImage(named: "birthday_calender_line")
    }
    else{
         return [13,4].contains(day) ? UIImage(named: "icon_cat") : nil
    }
}

但我如何从此委托方法更改选择日期图像

func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
    print("calendar did select date \(self.formatter.string(from: date))")
}

说当前图片是“holiday_calender_line”,并且在选择上不能改变“holiday_calender_solid”。

1 个答案:

答案 0 :(得分:-1)

试试这个..

.sqlproj