你好,我浏览过网络和许多博客,但似乎没有关于如何更改tapku日历控件标记日期的图像的信息。我对代码做了一些研究,但无法完成目标。
现在写,我能够更改日期图块的背景图像。但是当我这样做时,日期的文本消失了,有什么想法吗?
我已经更改了上面的图像TKmonthView.m
方法文件
- (void) drawTileInRect:(CGRect)r day:(int)day mark:(BOOL)mark font:(UIFont*)f1 font2:(UIFont*)f2 method
请我需要一些帮助这是我的代码
if(mark){
r.origin.y-=5;
[[UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Gray.png")] drawInRect:r];
r.size.height = 10;
r.origin.y += 18;
[@"•" drawInRect: r
withFont: f2
lineBreakMode: UILineBreakModeWordWrap
alignment: UITextAlignmentCenter];
}
看起来没有人愿意谈论它。但我想我已经找到了解决方案。我的应用程序的运行代码如下所示。它只需要一些测试,并且还需要选择标记日期,我需要一些解决方案。我会调查一下。我的解决方案如下
- (void) drawTileInRect:(CGRect)r day:(int)day mark:(BOOL)mark font:(UIFont*)f1 font2:(UIFont*)f2{
if (mark) {
r.origin.y-=6.5;
[[UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Gray.png")] drawInRect:r];
r.origin.y+=6.5;
}
NSString *str = [NSString stringWithFormat:@"%d",day];
r.size.height -= 2;
[str drawInRect: r
withFont: f1
lineBreakMode: UILineBreakModeWordWrap
alignment: UITextAlignmentCenter];
if(mark){
r.origin.y-=6;
// self.selectedImageView=[UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Gray.png")];
r.origin.y +=6;
r.size.height = 10;
r.origin.y += 18;
[@"•" drawInRect: r
withFont: f2
lineBreakMode: UILineBreakModeWordWrap
alignment: UITextAlignmentCenter];
}
}
这些图像位于:TapkuLibrary.bundle/Images/calendar/Month Calendar Today
或者您可以使路径指向您自己的图像之一。
self.selectedImageView.image = [UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/Month Calendar Today Selected Tile.png")];
// 你可以使用自己的图像
UIImage *tile = [UIImage imageWithContentsOfFile:TKBUNDLE(@"yourImage.png")];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)