Permalink
Browse files

Adding TapKu Calendar. Adding calendar view controller with fake data…

… as a test.
  • Loading branch information...
1 parent af31f78 commit 0bb05bc52fbf6fff4ffd08bc06bff561d7dba933 @jsakuda jsakuda committed May 20, 2012
Showing with 2,356 additions and 25 deletions.
  1. +61 −0 HI Capacity.xcodeproj/project.pbxproj
  2. +21 −0 HI Capacity/CalendarViewController.h
  3. +120 −0 HI Capacity/CalendarViewController.m
  4. +50 −25 HI Capacity/en.lproj/MainStoryboard_iPhone.storyboard
  5. +93 −0 vendor/TapkuLibrary/NSDate+TKCategory.h
  6. +218 −0 vendor/TapkuLibrary/NSDate+TKCategory.m
  7. +46 −0 vendor/TapkuLibrary/TKCalendarMonthTableViewController.h
  8. +111 −0 vendor/TapkuLibrary/TKCalendarMonthTableViewController.m
  9. +132 −0 vendor/TapkuLibrary/TKCalendarMonthView.h
  10. +993 −0 vendor/TapkuLibrary/TKCalendarMonthView.m
  11. +59 −0 vendor/TapkuLibrary/TKCalendarMonthViewController.h
  12. +79 −0 vendor/TapkuLibrary/TKCalendarMonthViewController.m
  13. +52 −0 vendor/TapkuLibrary/TKGlobal.h
  14. +42 −0 vendor/TapkuLibrary/TKGlobal.m
  15. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Gray.png
  16. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Selected.png
  17. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile Selected@2x.png
  18. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Date Tile.png
  19. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Left Arrow.png
  20. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Left Arrow@2x.png
  21. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Right Arrow.png
  22. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Right Arrow@2x.png
  23. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Shadow.png
  24. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Today Selected Tile.png
  25. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Calendar Today Tile.png
  26. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/Month Grid Top Bar.png
  27. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/datecell.png
  28. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/datecellselected.png
  29. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/leftarrow.png
  30. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/rightarrow.png
  31. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/shadow.png
  32. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/today.png
  33. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/todayselected.png
  34. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/calendar/topbar.png
  35. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/chatbubble.png
  36. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/chatbubble@2x.png
  37. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/clock.png
  38. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/clock@2x.png
  39. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/compass.png
  40. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/compass@2x.png
  41. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/eye.png
  42. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/eye@2x.png
  43. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/heart.png
  44. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/heart@2x.png
  45. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/key.png
  46. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/key@2x.png
  47. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/malePerson.png
  48. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/malePerson@2x.png
  49. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/movieclip.png
  50. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/movieclip@2x.png
  51. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/note.png
  52. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/note@2x.png
  53. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/photos.png
  54. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/photos@2x.png
  55. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/pictureframe.png
  56. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/pictureframe@2x.png
  57. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/search.png
  58. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/search@2x.png
  59. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/sign.png
  60. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/sign@2x.png
  61. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/star.png
  62. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/star@2x.png
  63. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/stopwatch.png
  64. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/stopwatch@2x.png
  65. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/television.png
  66. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/empty/television@2x.png
  67. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/bottomline.png
  68. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/close.png
  69. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/close@2x.png
  70. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/close_touch.png
  71. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/close_touch@2x.png
  72. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/goalline.png
  73. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/horizontalline.png
  74. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/mask.png
  75. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/mask@2x.png
  76. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/popdown.png
  77. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/popdown@2x.png
  78. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/popup.png
  79. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/popup@2x.png
  80. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/tick.png
  81. BIN vendor/TapkuLibrary/TapkuLibrary.bundle/Images/graph/vertical.png
  82. +50 −0 vendor/TapkuLibrary/UIImage+TKCategory.h
  83. +104 −0 vendor/TapkuLibrary/UIImage+TKCategory.m
  84. +55 −0 vendor/TapkuLibrary/UIView+TKCategory.h
  85. +70 −0 vendor/TapkuLibrary/UIView+TKCategory.m
@@ -7,6 +7,15 @@
objects = {
/* Begin PBXBuildFile section */
+ 09A4459C1567A6CD00634C53 /* NSDate+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A4458E1567A6CD00634C53 /* NSDate+TKCategory.m */; };
+ 09A4459D1567A6CD00634C53 /* TapkuLibrary.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 09A4458F1567A6CD00634C53 /* TapkuLibrary.bundle */; };
+ 09A4459E1567A6CD00634C53 /* TKCalendarMonthTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A445911567A6CD00634C53 /* TKCalendarMonthTableViewController.m */; };
+ 09A4459F1567A6CD00634C53 /* TKCalendarMonthView.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A445931567A6CD00634C53 /* TKCalendarMonthView.m */; };
+ 09A445A01567A6CD00634C53 /* TKCalendarMonthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A445951567A6CD00634C53 /* TKCalendarMonthViewController.m */; };
+ 09A445A11567A6CD00634C53 /* TKGlobal.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A445971567A6CD00634C53 /* TKGlobal.m */; };
+ 09A445A21567A6CD00634C53 /* UIImage+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A445991567A6CD00634C53 /* UIImage+TKCategory.m */; };
+ 09A445A31567A6CD00634C53 /* UIView+TKCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A4459B1567A6CD00634C53 /* UIView+TKCategory.m */; };
+ 09A445B11568645D00634C53 /* CalendarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 09A445B01568645D00634C53 /* CalendarViewController.m */; };
A39E33ED155FA29F0076ED6D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A39E33EC155FA29F0076ED6D /* UIKit.framework */; };
A39E33EF155FA29F0076ED6D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A39E33EE155FA29F0076ED6D /* Foundation.framework */; };
A39E33F1155FA29F0076ED6D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A39E33F0155FA29F0076ED6D /* CoreGraphics.framework */; };
@@ -47,6 +56,23 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 09A4458D1567A6CD00634C53 /* NSDate+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDate+TKCategory.h"; sourceTree = "<group>"; };
+ 09A4458E1567A6CD00634C53 /* NSDate+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDate+TKCategory.m"; sourceTree = "<group>"; };
+ 09A4458F1567A6CD00634C53 /* TapkuLibrary.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = TapkuLibrary.bundle; sourceTree = "<group>"; };
+ 09A445901567A6CD00634C53 /* TKCalendarMonthTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthTableViewController.h; sourceTree = "<group>"; };
+ 09A445911567A6CD00634C53 /* TKCalendarMonthTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthTableViewController.m; sourceTree = "<group>"; };
+ 09A445921567A6CD00634C53 /* TKCalendarMonthView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthView.h; sourceTree = "<group>"; };
+ 09A445931567A6CD00634C53 /* TKCalendarMonthView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthView.m; sourceTree = "<group>"; };
+ 09A445941567A6CD00634C53 /* TKCalendarMonthViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarMonthViewController.h; sourceTree = "<group>"; };
+ 09A445951567A6CD00634C53 /* TKCalendarMonthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthViewController.m; sourceTree = "<group>"; };
+ 09A445961567A6CD00634C53 /* TKGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKGlobal.h; sourceTree = "<group>"; };
+ 09A445971567A6CD00634C53 /* TKGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKGlobal.m; sourceTree = "<group>"; };
+ 09A445981567A6CD00634C53 /* UIImage+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TKCategory.h"; sourceTree = "<group>"; };
+ 09A445991567A6CD00634C53 /* UIImage+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TKCategory.m"; sourceTree = "<group>"; };
+ 09A4459A1567A6CD00634C53 /* UIView+TKCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+TKCategory.h"; sourceTree = "<group>"; };
+ 09A4459B1567A6CD00634C53 /* UIView+TKCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+TKCategory.m"; sourceTree = "<group>"; };
+ 09A445AF1568645D00634C53 /* CalendarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CalendarViewController.h; sourceTree = "<group>"; };
+ 09A445B01568645D00634C53 /* CalendarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CalendarViewController.m; sourceTree = "<group>"; };
A39E33E8155FA29F0076ED6D /* HI Capacity.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "HI Capacity.app"; sourceTree = BUILT_PRODUCTS_DIR; };
A39E33EC155FA29F0076ED6D /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
A39E33EE155FA29F0076ED6D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -120,9 +146,33 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 09A4458C1567A6CD00634C53 /* TapkuLibrary */ = {
+ isa = PBXGroup;
+ children = (
+ 09A4458D1567A6CD00634C53 /* NSDate+TKCategory.h */,
+ 09A4458E1567A6CD00634C53 /* NSDate+TKCategory.m */,
+ 09A4458F1567A6CD00634C53 /* TapkuLibrary.bundle */,
+ 09A445901567A6CD00634C53 /* TKCalendarMonthTableViewController.h */,
+ 09A445911567A6CD00634C53 /* TKCalendarMonthTableViewController.m */,
+ 09A445921567A6CD00634C53 /* TKCalendarMonthView.h */,
+ 09A445931567A6CD00634C53 /* TKCalendarMonthView.m */,
+ 09A445941567A6CD00634C53 /* TKCalendarMonthViewController.h */,
+ 09A445951567A6CD00634C53 /* TKCalendarMonthViewController.m */,
+ 09A445961567A6CD00634C53 /* TKGlobal.h */,
+ 09A445971567A6CD00634C53 /* TKGlobal.m */,
+ 09A445981567A6CD00634C53 /* UIImage+TKCategory.h */,
+ 09A445991567A6CD00634C53 /* UIImage+TKCategory.m */,
+ 09A4459A1567A6CD00634C53 /* UIView+TKCategory.h */,
+ 09A4459B1567A6CD00634C53 /* UIView+TKCategory.m */,
+ );
+ name = TapkuLibrary;
+ path = vendor/TapkuLibrary;
+ sourceTree = "<group>";
+ };
A39E33DD155FA29E0076ED6D = {
isa = PBXGroup;
children = (
+ 09A4458C1567A6CD00634C53 /* TapkuLibrary */,
A39E34281564E0D40076ED6D /* MKNetworkKit */,
A39E33F2155FA29F0076ED6D /* HI Capacity */,
A39E3413155FA29F0076ED6D /* HI CapacityTests */,
@@ -168,6 +218,8 @@
C8407A6C15662EFA001CAB68 /* PostsViewController.m */,
C8407A6E15663806001CAB68 /* PostContentViewController.h */,
C8407A6F15663806001CAB68 /* PostContentViewController.m */,
+ 09A445AF1568645D00634C53 /* CalendarViewController.h */,
+ 09A445B01568645D00634C53 /* CalendarViewController.m */,
);
path = "HI Capacity";
sourceTree = "<group>";
@@ -316,6 +368,7 @@
A39E33F7155FA29F0076ED6D /* InfoPlist.strings in Resources */,
A39E3400155FA29F0076ED6D /* MainStoryboard_iPhone.storyboard in Resources */,
A39E3403155FA29F0076ED6D /* MainStoryboard_iPad.storyboard in Resources */,
+ 09A4459D1567A6CD00634C53 /* TapkuLibrary.bundle in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -363,6 +416,14 @@
A39E34501564E4830076ED6D /* HTTPEngine.m in Sources */,
C8407A6D15662EFA001CAB68 /* PostsViewController.m in Sources */,
C8407A7015663806001CAB68 /* PostContentViewController.m in Sources */,
+ 09A4459C1567A6CD00634C53 /* NSDate+TKCategory.m in Sources */,
+ 09A4459E1567A6CD00634C53 /* TKCalendarMonthTableViewController.m in Sources */,
+ 09A4459F1567A6CD00634C53 /* TKCalendarMonthView.m in Sources */,
+ 09A445A01567A6CD00634C53 /* TKCalendarMonthViewController.m in Sources */,
+ 09A445A11567A6CD00634C53 /* TKGlobal.m in Sources */,
+ 09A445A21567A6CD00634C53 /* UIImage+TKCategory.m in Sources */,
+ 09A445A31567A6CD00634C53 /* UIView+TKCategory.m in Sources */,
+ 09A445B11568645D00634C53 /* CalendarViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,21 @@
+//
+// CalendarViewController.h
+// HI Capacity
+//
+// Created by Julie Ann Sakuda on 5/19/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "TKCalendarMonthTableViewController.h"
+
+@interface CalendarViewController : TKCalendarMonthTableViewController {
+
+}
+
+@property (retain,nonatomic) NSMutableArray *dataArray;
+@property (retain,nonatomic) NSMutableDictionary *dataDictionary;
+
+- (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end;
+
+@end
@@ -0,0 +1,120 @@
+//
+// CalendarViewController.m
+// HI Capacity
+//
+// Created by Julie Ann Sakuda on 5/19/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#import "CalendarViewController.h"
+#import "NSDate+TKCategory.h"
+
+@interface CalendarViewController ()
+
+@end
+
+@implementation CalendarViewController
+
+@synthesize dataArray, dataDictionary;
+
+
+- (void)viewDidLoad{
+ [super viewDidLoad];
+ [self.monthView selectDate:[NSDate month]];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+// [[[self navigationController] navigationBar] setHidden:YES];
+}
+
+- (void)viewDidAppear:(BOOL)animated {
+ [super viewDidAppear:animated];
+ //NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ //[dateFormatter setDateFormat:@"dd.MM.yy"];
+ //NSDate *d = [dateFormatter dateFromString:@"02.05.11"];
+ //[dateFormatter release];
+ //[self.monthView selectDate:d];
+}
+
+- (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate {
+ [self generateRandomDataForStartDate:startDate endDate:lastDate];
+ return dataArray;
+}
+- (void) calendarMonthView:(TKCalendarMonthView*)monthView didSelectDate:(NSDate*)date{
+
+ // CHANGE THE DATE TO YOUR TIMEZONE
+ TKDateInformation info = [date dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ NSDate *myTimeZoneDay = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone systemTimeZone]];
+
+ NSLog(@"Date Selected: %@",myTimeZoneDay);
+
+ [self.tableView reloadData];
+}
+
+- (void) calendarMonthView:(TKCalendarMonthView*)mv monthDidChange:(NSDate*)d animated:(BOOL)animated{
+ [super calendarMonthView:mv monthDidChange:d animated:animated];
+ [self.tableView reloadData];
+}
+
+
+- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
+ return 1;
+
+}
+- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+ NSArray *ar = [dataDictionary objectForKey:[self.monthView dateSelected]];
+ if(ar == nil) return 0;
+ return [ar count];
+}
+- (UITableViewCell *) tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+
+ static NSString *CellIdentifier = @"Cell";
+ UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:CellIdentifier];
+ if (cell == nil) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
+
+
+
+ NSArray *ar = [dataDictionary objectForKey:[self.monthView dateSelected]];
+ cell.textLabel.text = [ar objectAtIndex:indexPath.row];
+
+ return cell;
+
+}
+
+
+- (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end{
+ // this function sets up dataArray & dataDictionary
+ // dataArray: has boolean markers for each day to pass to the calendar view (via the delegate function)
+ // dataDictionary: has items that are associated with date keys (for tableview)
+
+
+ NSLog(@"Delegate Range: %@ %@ %d",start,end,[start daysBetweenDate:end]);
+
+ self.dataArray = [NSMutableArray array];
+ self.dataDictionary = [NSMutableDictionary dictionary];
+
+ NSDate *d = start;
+ while(YES){
+
+ int r = arc4random();
+ if(r % 3==1){
+ [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",@"Item two",nil] forKey:d];
+ [self.dataArray addObject:[NSNumber numberWithBool:YES]];
+
+ }else if(r%4==1){
+ [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",nil] forKey:d];
+ [self.dataArray addObject:[NSNumber numberWithBool:YES]];
+
+ }else
+ [self.dataArray addObject:[NSNumber numberWithBool:NO]];
+
+
+ TKDateInformation info = [d dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ info.day++;
+ d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ if([d compare:end]==NSOrderedDescending) break;
+ }
+
+}
+
+@end
Oops, something went wrong.

0 comments on commit 0bb05bc

Please sign in to comment.