2011-11-23 73 views
4

喜标记的日期选择的图像,我已经通过网络和许多博客走了,但似乎有关于如何改变tapku日历control.I的标注日期的图像没有做过信息一些关于代码的研究却无法完成目标。改变对Tapku日历

写信跟我能更改日期瓦的backgournd图像。但当我这样做的日期文本消失的任何想法?

我已经改变了图像上的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]; 
} 

貌似家伙没有人愿意谈论它。但我想我已经到了一个solution.The运行的代码我的应用程序看起来像this.It只是需要一些测试,也为标注日期的选择我需要一些solution.I会考虑它。我的解决方案如下

- (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]; 

} 


} 

回答

0

图片可在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")];