41883c8216
1. Bring in ‘showsPlaceholder’ 2. Rendering Event indicators by image instead of CALayer 3. Using FSCalendarAnimator to control animations 4. Update Examples 5. Code clean
65 lines
1.6 KiB
Objective-C
65 lines
1.6 KiB
Objective-C
//
|
|
// ViewDidLoadExampleViewController.m
|
|
// FSCalendar
|
|
//
|
|
// Created by DingWenchao on 6/25/15.
|
|
// Copyright (c) 2015 =. All rights reserved.
|
|
//
|
|
|
|
#import "ViewDidLoadExampleViewController.h"
|
|
|
|
@implementation ViewDidLoadExampleViewController
|
|
|
|
- (void)dealloc
|
|
{
|
|
NSLog(@"%@:%s", self.class.description, __FUNCTION__);
|
|
}
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
self.title = @"FSCalendar";
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)loadView
|
|
{
|
|
UIView *view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
|
|
view.backgroundColor = [UIColor groupTableViewBackgroundColor];
|
|
self.view = view;
|
|
}
|
|
|
|
- (void)viewDidLoad
|
|
{
|
|
[super viewDidLoad];
|
|
|
|
CGFloat height = [[UIDevice currentDevice].model hasPrefix:@"iPad"] ? 450 : 300;
|
|
FSCalendar *calendar = [[FSCalendar alloc] initWithFrame:CGRectMake(0, 64, self.view.frame.size.width, height)];
|
|
calendar.dataSource = self;
|
|
calendar.delegate = self;
|
|
[calendar selectDate:[calendar dateWithYear:2015 month:2 day:1]];
|
|
calendar.backgroundColor = [UIColor whiteColor];
|
|
[self.view addSubview:calendar];
|
|
self.calendar = calendar;
|
|
|
|
}
|
|
|
|
- (void)calendar:(FSCalendar *)calendar didSelectDate:(NSDate *)date
|
|
{
|
|
NSLog(@"did select date %@",[calendar stringFromDate:date format:@"yyyy/MM/dd"]);
|
|
}
|
|
|
|
- (void)calendarCurrentPageDidChange:(FSCalendar *)calendar
|
|
{
|
|
NSLog(@"did change to page %@",[calendar stringFromDate:calendar.currentPage format:@"MMMM YYYY"]);
|
|
}
|
|
|
|
- (BOOL)calendar:(FSCalendar *)calendar hasEventForDate:(NSDate *)date
|
|
{
|
|
return [calendar dayOfDate:date] == 5;
|
|
}
|
|
|
|
@end
|