我尚未找到仅更改“今天”日期颜色的属性。如果我选择了其他日期,那么它将仅显示今天的日期颜色更改。如何在FSCalendar swift中实现这一目标?
附上图像供参考。今天日期颜色是绿色。 3月17日。
外观方法:
func calendar(_ calendar: FSCalendar, appearance: FSCalendarAppearance, titleDefaultColorFor date: Date) -> UIColor? {
calendar.appearance.todayColor = nil
return UIColor.white
}
日历图像:
因为它是用Objective-C编写的,所以导航到pods,然后找到库并查找FSCalendar.m
,然后转到此处
- (void)reloadDataForCell:(FSCalendarCell *)cell atIndexPath:(NSIndexPath *)indexPath
在方法末尾添加此内容
if (cell.dateIsToday) {
cell.shapeLayer.backgroundColor = [UIColor redColor].CGColor;
cell.shapeLayer.opacity = 1.0;
}