ios - 在日历视图 ios 上显示事件标签/字符串?
问题描述
我正在开发我的一个 iOS 应用程序,我需要在该应用程序中添加日期事件,我正在尝试实现如下图所示的 UI 结果。
我已经使用FSCalendar 、 JTAppleCalendar 等解决了大部分区域,但我满足了我正在寻找的大多数要求,除了在 date 添加事件标签/字符串。
使用 FSCalendar 库添加了当前状态截图。我只能看到点(ImageView)FSCalendar
不允许我在日期上添加标签/字符串。
这是我的目标。
谁能帮助我如何实现这一目标?
先感谢您。
解决方案
// 检查 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)
}
推荐阅读
- c# - ElasticSearch 简单示例不起作用 c#
- ckeditor - 带有 XPage 的 CKEditor 仅显示 1 行 HTML / DXL 代码
- docker - 在 docker 中执行用户 cron 作业的问题
- sas - SAS substr 合并
- android - 谷歌地图GroundOverlays默认情况下是否具有抗锯齿功能?
- c# - 如何使用 HttpClient 调用具有自定义安全性(非 SOAP)的 SSRS Rest-Api V2.0
- react-native - iOS 设备上的网络请求失败 || 反应原生 || 世博会
- google-colaboratory - 尝试将文件从 Google Drive 复制到 Google Colab 时出现输入/输出错误
- c# - 如何在 kibana 中将日志设置为 ELK,并使用 serilog 进行身份验证
- python - 添加一个while循环以不断询问名称,直到用户键入退出