完成在 Tapku 库中以单一背景颜色标记日期需要三种颜色 Objective C
我正在使用 tapku 库在我的应用程序中显示日历。我已经完成了所有日期计算并根据我的需要正确标记了单元格,但我想根据我的选择为单元格提供不同的颜色。我已经用单一背景颜色进行了标记,但我想以三种颜色显示。我该怎么办?
I am using tapku library for displaying calender in my application. I have done all date calculations and marked the cells properly acccording to my need but I want to give a different color to the cell according to my choice. I have done marking in single background color but I want to display in three colors. How can I?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看方法:
在drawRect:方法中将颜色设置为[UIColor greyColor](代码如下)。您可以做的是检查该日期是否是您感兴趣的日期,然后适当地更改颜色。我不确定你想如何区分你的约会——这是你的决定;过去,我将 mark 参数的参数更改为 int 之类的参数,然后根据 int 的值设置颜色。标记参数来自标记数组,因此如果您传入具有不同值的数组,然后在整个 TKCalendarMonthView 中更改方法参数,应该没问题。
例如,假设您想要:mark = 1 -->画红色;标记 = 2 -->画绿色;标记> 2 -->画蓝色。
希望这能回答您的问题。
Look at the method:
The color is set to [UIColor grayColor] in the drawRect: method (one below in the code). What you can do is check if the date is a date you're interested in and then change the color appropriately. I'm not sure how you want to differentiate between your dates--it's your call; in the past, I've changed the parameter of the mark argument to something like an int and then basing the color on the int's value. The mark argument comes from the marks array, so if you pass in an array with different values and then change the method arguments throughout the TKCalendarMonthView, it should be okay.
For example, lets say you want: mark = 1 --> draw red; mark = 2 --> draw green; mark > 2 --> draw blue.
Hope this answers your question.