如何更改 TapkuLibrary 日历对象上的事件标记
我的日历使用 TapkuLibrary。我想更改事件标记,例如在该月的某些日子显示不同的操作。我想要实现类似第二张图片的效果。
默认 TapkuLibrary 日历
我想要喜欢这样的东西
I use TapkuLibrary for my calendar. I want to change the event marks, for example to show different operations on certain days of the month. I want to achieve something like the second image.
Default TapkuLibrary calendar
I want to like something like this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
注意:我首先要解释 Tapku 当前如何绘制其 MonthView 标记,然后我将提出一种更改它的方法。
Tapku 实际上并没有将这些标记设置为图像;而是将这些标记设置为图像。它将它们设置为字符串!在 TKCalendarMonthView 中搜索 •。标记在 TKCalendarMonthView 中的两个不同位置设置:首先,在 drawTileInRect:day:mark:font... 方法中,该方法在 drawRect 方法中在每个图块上单独调用。其次,属性“点”应用于用户“选定”的单元格,该单元格具有不同的文本颜色等,因此需要调整其自己的属性。
要设置您自己的图像,您必须在这两个地方修改 Tapku(不是非常困难;这是一个非常容易访问的项目)。因此,您不必将单元格的文本设置为•,而是必须将其图像设置为您提供的图像。
可以通过几种不同的方式提供此图像。最直接的方法是重做 Tapku 的“marks”数组概念(由委托设置)。也许您可以创建 UIImage 数组,而不是创建整数数组。尽管如此,您仍然需要有一种方法来告诉代码“无图像”——也许有一个空白图像,然后默认将其应用到单元格?
如果您需要任何说明,请告诉我。
N.B. I'm first going to explain how Tapku currently draws its MonthView marks, and then I'll propose a way to change it.
Tapku doesn't actually set those marks as images; it sets them as strings! Search TKCalendarMonthView for •. The marks are set in two different places in TKCalendarMonthView: First, in the drawTileInRect:day:mark:font... method, which is called on each tile individually in the drawRect method. Second, with the property 'dot', which is applied to the user's 'selected' cell, which has a different text color, etc. and thus needs to have its own properties adjusted.
To set your own images, you'll have to modify Tapku in those two places (not terribly difficult; it's a pretty accessible project). So, instead of setting the cell's text to •, you'll have to set its image to an image you provide.
Providing this image could be done in a few different ways. The most straightforward will be to redo Tapku's concept of the 'marks' array (set by the delegate). Instead of creating an array of integers, perhaps you could create an array of UIImages. Still, you need to have a way to tell the code "no image"--maybe have a blank image and just apply it to cells by default?
Let me know if you need any clarification.
使用下面的方法而不是 - DrawTileInRect
一个月内有多种颜色,请检查日期
use bellow method instead of - DrawTileInRect
for multiple color in one month , check date