Code Monkey home page Code Monkey logo

Comments (4)

devinross avatar devinross commented on June 27, 2024

Do you have a screen shot?

from tapkulibrary.

devinross avatar devinross commented on June 27, 2024

I think this is not a library issue, but an issue on your side. Can you prove me wrong?

from tapkulibrary.

matanelgabsi avatar matanelgabsi commented on June 27, 2024

Sorry for my late response. i thought i would get an email notification in case you would respond to this.
anyway, you can see a screen shot here:
http://i.imagehost.org/0195/Picture_19.png
you can download my relevant code from here:
http://www.megafileupload.com/en/file/206853/Archive-zip.html
As you can see there, i have done nothing special.

thank you very much!

from tapkulibrary.

wassupdoc avatar wassupdoc commented on June 27, 2024

I ran into a similar issue. I overrode the necessary methods to include the ability to include a frame in the calendar.

#import  //UIKit/UIKit.h
#import  //TapkuLibrary/TapkuLibrary.h

@interface TKCalendarMonthView (Framed)

- (id) initWithFrame:(CGRect)frame;
- (void) drawMonthLabel:(CGRect)rect;
- (void) drawDayLabels:(CGRect)rect;
- (void) drawRect:(CGRect)rect; 

@end

@implementation TKCalendarMonthView (Framed)


- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
        self.backgroundColor = [UIColor clearColor];
        
        TKDateInformation info = [[NSDate date] dateInformation];
        info.second = info.minute = info.hour = 0;
        info.day = 1;
        [self setCurrentMonth:[NSDate dateFromDateInformation:info]];
        
        monthYear = [[NSString stringWithFormat:@"%@ %@",[currentMonth month],[currentMonth year]] copy];
        [self setSelectedMonth:currentMonth];
        
        [self loadButtons];
        
        float hgt = CGRectGetHeight(frame) - 44;
        float wdt = CGRectGetWidth(frame);
        float oriX = CGRectGetMinX(frame);
        float oriY = CGRectGetMinY(frame)- 55; //where the top of the calendar will be
        
        scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(oriX, oriY, wdt, hgt)];
        scrollView.contentSize = CGSizeMake(320,100);
        [self addSubview:scrollView];
            
        scrollView.scrollEnabled = NO;
        scrollView.backgroundColor =[UIColor colorWithRed:222/255.0 green:222/255.0 blue:225/255.0 alpha:1];
        
        shadow = [[UIImageView alloc] initWithImage:[UIImage imageFromPath:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/shadow.png")]];
        deck = [[NSMutableArray alloc] initWithCapacity:3];
        
        [self addSubview:shadow];
        [self loadInitialGrids];
    }
    return self;
}




- (void) drawRect:(CGRect)rect {
        // Drawing code
    
        //[self reload];
    
    
    [[UIImage imageFromPath:TKBUNDLE(@"TapkuLibrary.bundle/Images/calendar/topbar.png")] drawAtPoint:CGPointMake(0,0)];
    
    
    [self drawDayLabels:[self bounds]];
    [self drawMonthLabel:[self bounds]];
    
    
}

- (void) drawDayLabels:(CGRect)rect{
    
    
        // Calendar starting on Monday instead of Sunday (Australia, Europe agains US american calendar)
    NSArray *days;
    CFCalendarRef currentCalendar = CFCalendarCopyCurrent();
    if (CFCalendarGetFirstWeekday(currentCalendar) == 2) 
        days = [NSArray arrayWithObjects:@"Mon",@"Tue",@"Wed",@"Thu",@"Fri",@"Sat",@"Sun",nil];
    else 
        days = [NSArray arrayWithObjects:@"Sun",@"Mon",@"Tue",@"Wed",@"Thu",@"Fri",@"Sat",nil];
    CFRelease(currentCalendar); 
    
    
    UIFont *f = [UIFont boldSystemFontOfSize:10];
    [[UIColor darkGrayColor] set];
    
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);
    CGContextSetShadowWithColor(context,  CGSizeMake(0.0, -1.0), 0.5, [[UIColor whiteColor]CGColor]);
    
    
    int i = 0;
    for(NSString *str in days){
        [str drawInRect:CGRectMake(i * 46, 44-12, 45, 10) withFont:f lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
        i++;
    }
    CGContextRestoreGState(context);
}


- (void) drawMonthLabel:(CGRect)rect{
    
    if(monthYear != nil){
        CGRect r = CGRectInset([self bounds], 55, 8);
        r.size.height=42;
        [[UIColor colorWithRed:75.0/255.0 green:92/255.0 blue:111/255.0 alpha:1] set];
        [monthYear drawInRect:r 
                     withFont:[UIFont boldSystemFontOfSize:20.0] 
                lineBreakMode:UILineBreakModeWordWrap 
                    alignment:UITextAlignmentCenter];
    }
}



@end

from tapkulibrary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.