Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding weekday header cells for each month
- Loading branch information
Showing
9 changed files
with
161 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// MNCalendarViewDayCell.h | ||
// MNCalendarView | ||
// | ||
// Created by Min Kim on 7/28/13. | ||
// Copyright (c) 2013 min. All rights reserved. | ||
// | ||
|
||
#import "MNCalendarViewCell.h" | ||
|
||
extern NSString *const MNCalendarViewDayCellIdentifier; | ||
|
||
@interface MNCalendarViewDayCell : MNCalendarViewCell | ||
|
||
@property(nonatomic,strong,readonly) NSDate *date; | ||
@property(nonatomic,strong,readonly) NSDate *month; | ||
|
||
- (void)setDate:(NSDate *)date | ||
month:(NSDate *)month | ||
calendar:(NSCalendar *)calendar; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// MNCalendarViewDayCell.m | ||
// MNCalendarView | ||
// | ||
// Created by Min Kim on 7/28/13. | ||
// Copyright (c) 2013 min. All rights reserved. | ||
// | ||
|
||
#import "MNCalendarViewDayCell.h" | ||
|
||
NSString *const MNCalendarViewDayCellIdentifier = @"MNCalendarViewDayCellIdentifier"; | ||
|
||
@interface MNCalendarViewDayCell() | ||
|
||
@property(nonatomic,strong,readwrite) NSDate *date; | ||
@property(nonatomic,strong,readwrite) NSDate *month; | ||
|
||
@end | ||
|
||
@implementation MNCalendarViewDayCell | ||
|
||
- (void)setDate:(NSDate *)date | ||
month:(NSDate *)month | ||
calendar:(NSCalendar *)calendar { | ||
|
||
self.date = date; | ||
self.month = month; | ||
self.calendar = calendar; | ||
|
||
NSDateComponents *components = | ||
[self.calendar components:NSMonthCalendarUnit|NSDayCalendarUnit | ||
fromDate:self.date]; | ||
|
||
NSDateComponents *monthComponents = | ||
[self.calendar components:NSMonthCalendarUnit | ||
fromDate:self.month]; | ||
|
||
self.titleLabel.text = [NSString stringWithFormat:@"%d", components.day]; | ||
self.enabled = monthComponents.month == components.month; | ||
|
||
[self setNeedsDisplay]; | ||
} | ||
|
||
- (void)setEnabled:(BOOL)enabled { | ||
[super setEnabled:enabled]; | ||
|
||
self.titleLabel.textColor = | ||
self.enabled ? UIColor.darkTextColor : UIColor.lightGrayColor; | ||
|
||
self.backgroundColor = | ||
self.enabled ? UIColor.whiteColor : [UIColor colorWithRed:.96f green:.96f blue:.96f alpha:1.f]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// MNCalendarWeekdayViewCell.h | ||
// MNCalendarView | ||
// | ||
// Created by Min Kim on 7/28/13. | ||
// Copyright (c) 2013 min. All rights reserved. | ||
// | ||
|
||
#import "MNCalendarViewCell.h" | ||
|
||
extern NSString *const MNCalendarViewWeekdayCellIdentifier; | ||
|
||
@interface MNCalendarViewWeekdayCell : MNCalendarViewCell | ||
|
||
@property(nonatomic,assign) NSUInteger weekday; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// MNCalendarWeekdayViewCell.m | ||
// MNCalendarView | ||
// | ||
// Created by Min Kim on 7/28/13. | ||
// Copyright (c) 2013 min. All rights reserved. | ||
// | ||
|
||
#import "MNCalendarViewWeekdayCell.h" | ||
|
||
NSString *const MNCalendarViewWeekdayCellIdentifier = @"MNCalendarViewWeekdayCellIdentifier"; | ||
|
||
@implementation MNCalendarViewWeekdayCell | ||
|
||
- (void)setWeekday:(NSUInteger)weekday { | ||
_weekday = weekday; | ||
|
||
[self setNeedsDisplay]; | ||
} | ||
|
||
@end |