Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9026805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:36:36+00:00 2026-06-16T06:36:36+00:00

I’m using the standard implementation of the TKCalendar for iOS and because there isn’t

  • 0

I’m using the standard implementation of the TKCalendar for iOS and because there isn’t much documentation on it I was wondering if anyone knows of a simply way of setting a custom image for a day of the month.

Any help is greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:36:37+00:00Added an answer on June 16, 2026 at 6:36 am

    No, that’s all of your answers are wrong. What I wanted was the ability to change each day’s image to a custom image that I would choose for every day.
    I hacked the code together and got it to work . If anyone is looking for how to do this, just got go to TKCalendarMonthView.m and find the

    - (void) drawRect:(CGRect)rect
    

    method. Now in this method, copy in the following (this is a simplified version of the code that I have so you have to build it up yourself):

    CGContextRef context = UIGraphicsGetCurrentContext();
    
        UIImage *tile = [UIImage imageWithContentsOfFile:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile.png")];
    
    CGRect r = CGRectMake(0, 0, 46, 44);
    CGContextDrawTiledImage(context, r, tile.CGImage);
    
    
    
    int index = 0;
    
    UIFont *font = [UIFont boldSystemFontOfSize:dateFontSize];
    UIFont *font2 =[UIFont boldSystemFontOfSize:dotFontSize];
    UIColor *color = [UIColor grayColor];
    
        //first do the boxes that are still visible from the previous month 
        //
        //
    
    if(firstOfPrev>0){
        [color set];
        for(int i = firstOfPrev;i<= lastOfPrev;i++){
            r = [self rectForCellAtIndex:index];
    
        ///////////////////////////
        ///////////////////////////
        ///////////////////////////
    
        int indexMoved = 7;
        r.origin.y -= indexMoved; //this moves the block to put it back in it's place
    
        //add an image to the rect - note you can add them over each other 
        [[UIImage imageNamed:[NSString stringWithFormat:@"t.png"]] drawInRect:r];
    
    
        r.origin.y += indexMoved; //move back the block
    
    
        ///////////////////////////
        ///////////////////////////
        ///////////////////////////
    
    
            if ([marks count] > 0)
                [self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2];
            else
                [self drawTileInRect:r day:i mark:NO font:font font2:font2];
            index++;
    
        }
    }
    
    
        //Now to blocks for current month 
        //
        //
    color = [UIColor colorWithRed:59/255. green:73/255. blue:88/255. alpha:1];
    [color set];
    
    for(int i=1; i <= daysInMonth; i++){
        r = [self rectForCellAtIndex:index];
    
         ///////////////////////////
        ///////////////////////////
        ///////////////////////////
    
        int indexMoved = 7;
        r.origin.y -= indexMoved; //this moves the block to put it back in it's place
    
        //add an image to the rect - note you can add them over each other 
        [[UIImage imageNamed:[NSString stringWithFormat:@"t.png"]] drawInRect:r];
    
    
        r.origin.y += indexMoved; //move back the block
    
    
        ///////////////////////////
        ///////////////////////////
        ///////////////////////////
    
        if(today == i){ //this is done to highlight today's block
            int indexMoved = 7;
            r.origin.y -= indexMoved;
            [[UIColor colorWithRed:59/255. green:73/255. blue:88/255. alpha:1] set];
            //set the image to whatever you want today's block to have
            [[UIImage imageNamed:[NSString stringWithFormat:@"Tile-Border-Green.png"]] drawInRect:r];
            r.origin.y += indexMoved;
        }
    
        if ([marks count] > 0)
            [self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2];
        else
            [self drawTileInRect:r day:i mark:NO font:font font2:font2];
        index++;
    
    }
    
    //Finally, do blocks for the next month who's blocks are visible 
        //
        //
    
    [[UIColor grayColor] set];
    int i = 1;
    while(index % 7 != 0){
        r = [self rectForCellAtIndex:index] ;
    
    
        ///////////////////////////
        ///////////////////////////
        ///////////////////////////
    
        int indexMoved = 7;
        r.origin.y -= indexMoved; //this moves the block to put it back in it's place
    
        //add an image to the rect - note you can add them over each other 
        [[UIImage imageNamed:[NSString stringWithFormat:@"t.png"]] drawInRect:r];
    
    
        r.origin.y += indexMoved; //move back the block
    
    
        ///////////////////////////
        ///////////////////////////
        ///////////////////////////
    
        if ([marks count] > 0)
            [self drawTileInRect:r day:i mark:[[marks objectAtIndex:index] boolValue] font:font font2:font2];
        else
            [self drawTileInRect:r day:i mark:NO font:font font2:font2];
        i++;
        index++;
    
    
    }
    

    Notice that it’s spilt into three main areas (each with a for loop). These are (in order) the blocks from the previous month that are still visible, the blocks from the current month and lastly the blocks from the coming month that are visible in the current view.

    I really hope this helps someone because it took be a lot of headache to set up!

    Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.