ios - 在日历 View iOS上显示事件标签/字符串?

标签 ios swift nscalendar fscalendar

我正在使用我的iOS应用程序之一,该应用程序需要在日期上添加事件,我正在尝试实现以下波纹屏幕截图中的UI结果。

我已经使用FSCalendar,JTAppleCalendar等解决了大部分区域,但是我满足了我正在寻找的大多数要求,除了在日期上添加了事件标签/字符串。

使用FSCalendar库添加了当前状态屏幕截图。我只能看到点(ImageView)FSCalendar不允许我在日期上添加标签/字符串。

这是我的目标。

enter image description here

谁能帮我实现这个目标?

先感谢您。

最佳答案

//检查FSCalendarDataSource
//通知代表指定的单元格将要在日历中显示。

func calendar(_ calendar: FSCalendar, willDisplay cell: FSCalendarCell, for date: Date, at monthPosition: FSCalendarMonthPosition) {

        let labelMy2 = UILabel(frame: CGRect(x: 10, y: 20, width: cell.bounds.width, height: 20))
        labelMy2.font = UIFont(name: "Henderson BCG Sans", size: 10)
        labelMy2.text = "abc"
        labelMy2.layer.cornerRadius = cell.bounds.width/2
        labelMy2.textColor = UIColor.init(hex: "#32C77F")
        cell.addSubview(labelMy2)

}

关于ios - 在日历 View iOS上显示事件标签/字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62016056/

相关文章:

ios - 计算年、月、日中2个NSDate之间的差异忽略时间?

ios - 每周特定日期的 NSDate 扩展

ios - 核心数据对象未正确更新或发布定义日期组件

ios - NSUserDefaults 在 View 之间被删除

ios - 在两个对象之间添加 NSLayoutConstraint

ios - 如何获取结构中伴随的 var 值?

ios - 如何将 Firebase 数据保存到数组中

iphone - iOS锁定事件?

ios - map View : didSelectAnnotationView: not functioning properly.

swift - 如何将 Int 拆分为其各个数字?