Search code examples
objective-cioscocoa-touchtapku

How can I change the event marks on TapkuLibrary calendar object


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

Default TapkuLibrary calendar

I want to like something like this

I want to like something like this


Solution

  • use bellow method instead of - DrawTileInRect for multiple color in one month , check date

    - (void) drawTileInRect:(CGRect)r day:(int)day mark:(BOOL)mark font:(UIFont*)f1 font2:(UIFont*)f2 sysFlag:(int)sysFlg userEventFlg:(int)userEventFlag diaryFlg:(int)diaryFlag momentsFlg:(int)momentsFlag
    {
       
        @try {
            
            NSString *str = [NSString stringWithFormat:@"%d",day];
            [str retain];
            
            
            r.size.height -= 2;
            [str drawInRect: r
                   withFont: f1
              lineBreakMode: UILineBreakModeWordWrap
                  alignment: UITextAlignmentCenter];
            
            r.size.height = 10;
            r.origin.y += 18;
            
            CGRect y=CGRectMake(r.origin.x+5, r.origin.y-25, 12, 12);//5 5
            
            
            CGRect rect1=CGRectMake(r.origin.x, r.origin.y+7, 12, 12);
            CGRect rect2=CGRectMake(rect1.origin.x+18, r.origin.y+7, 12, 12);
            CGRect rect3=CGRectMake(rect2.origin.x+16, r.origin.y+7, 12, 12);
            
            if(sysFlg==1)
            {
                [[UIImage imageNamed:@"Blue_dot.png"] drawInRect:y];
            }
            
            if(userEventFlag==1)//1.png
            {
                [[UIImage imageNamed:@"Yellow_dot.png"] drawInRect:rect1];
            }
            
            
            if(momentsFlag==1)//3.png
            {
                [[UIImage imageNamed:@"Red_dot.png"] drawInRect:rect3];
            }
            
    
        }
        @catch (NSException * e) {
            NSLog(@"Exception: %@", e);
    
        }
    }