[Code Note] calendar and note calendar
I ,.
2. Engineering Drawing.
3. Code.
RootViewController. h
#import <UIKit/UIKit.h>#import "CalendarView.h"#import "CalendarUtils.h"#import "CalendarStyle.h"@interface RootViewController : UIViewController<CalendarViewDelegate>{ CalendarView *calendarView;}@end
RootViewController. m
# Import "RootViewController. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. self. title = @ "Calendar"; [self initWithCalendarView];}-(void) else {if (calendarView) [calendarView removeFromSuperview]; calendarView = [[CalendarView alloc] initWithFrame: CGRectMake (10, self. view. bounds. size. height-200-320 + 20,300,300)]; [calendarView refleshriCheng: ^ (NSDate * date, NSString * str) {if ([str isEqualToString: @ "left"]) {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Reminder" message: @ "click the left button" delegate: self cancelButtonTitle: @ "cancel" otherButtonTitles: @ "OK", nil]; [alert show];} else if ([str isinclutostring: @ "right"]) {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Reminder" message: @ "click" delegate: self cancelButtonTitle: @ "cancel" otherButtonTitles: @ "OK", nil]; [alert show] ;}}]; calendarView. delegate = self; [self. view addSubview: calendarView] ;}# pragma-mark-CalendarViewDelegate-(void) calendarViewDidSelectDate :( NSDate *) date todayDate :( NSDate *) todayDate {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ "Reminder" message: @ "date clicked" delegate: self cancelButtonTitle: @ "cancel" otherButtonTitles: @ "OK", nil]; [alert show];}-(void) didReceiveMemoryWarning {[super didreceivemorywarning]; // Dispose of any resources that can be recreated .}