Skip to content
This repository
Browse code

Revamped calendar day view classes and added proper documentation. Re…

…moved TKDateInformation in favor of NSDateComponent. Now using time zones for NSDate category and calendar month grid. Refactoring: latest objective-c syntax, more uniformity.
  • Loading branch information...
commit 5e488a675101ae35e01b0d2c1f33aee2a9bc2115 1 parent 5eeb23e
Devin Ross authored

Showing 94 changed files with 2,166 additions and 2,256 deletions. Show diff stats Hide diff stats

  1. BIN  demo/Assets/Images/launch_iphone-568h@2x.png
  2. BIN  demo/Assets/Images/launch_iphone.png
  3. BIN  demo/Assets/Images/launch_iphone@2x.png
  4. +2 2 demo/Classes/AlertsViewController.m
  5. +6 5 demo/Classes/AppDelegate.h
  6. +4 29 demo/Classes/AppDelegate.m
  7. +16 0 demo/Classes/CalendarDayViewController.h
  8. +75 0 demo/Classes/CalendarDayViewController.m
  9. +3 3 demo/Classes/CalendarMonthViewController.h
  10. +26 19 demo/Classes/CalendarMonthViewController.m
  11. +4 8 demo/Classes/CoverflowViewController.h
  12. +4 44 demo/Classes/CoverflowViewController.m
  13. +2 2 demo/Classes/DetailViewController.h
  14. +5 16 demo/Classes/DetailViewController.m
  15. +1 1  demo/Classes/EmptyViewController.m
  16. +4 4 demo/Classes/HUDViewController.h
  17. +17 17 demo/Classes/HUDViewController.m
  18. +6 8 demo/Classes/ImageCenterViewController.m
  19. +3 3 demo/Classes/LabelViewController.m
  20. +6 5 demo/Classes/MoreCellsViewController.h
  21. +11 11 demo/Classes/MoreCellsViewController.m
  22. +1 2  demo/Classes/{NetworkRequestViewController.h → NetworkRequestProgressViewController.h}
  23. +16 39 demo/Classes/{NetworkRequestViewController.m → NetworkRequestProgressViewController.m}
  24. +1 3 demo/Classes/RootViewController.h
  25. +43 26 demo/Classes/RootViewController.m
  26. +10 0 demo/Demo-Info.plist
  27. +20 10 demo/Demo.xcodeproj/project.pbxproj
  28. +1 0  demo/Demo_Prefix.pch
  29. +2 2 src/DataTests.m
  30. BIN  src/TapkuLibrary.bundle/Images/calendar/nob.png
  31. BIN  src/TapkuLibrary.bundle/Images/calendar/nob@2x.png
  32. BIN  src/TapkuLibrary.bundle/Images/calendar/timeline.png
  33. BIN  src/TapkuLibrary.bundle/Images/calendar/timeline@2x.png
  34. +9 17 src/TapkuLibrary.xcodeproj/project.pbxproj
  35. +6 6 src/TapkuLibrary/NSDate+CalendarGrid.h
  36. +29 23 src/TapkuLibrary/NSDate+CalendarGrid.m
  37. +109 25 src/TapkuLibrary/NSDate+TKCategory.h
  38. +108 132 src/TapkuLibrary/NSDate+TKCategory.m
  39. +4 4 src/TapkuLibrary/NSObject+TKCategory.m
  40. +14 17 src/TapkuLibrary/TKAlertCenter.m
  41. +13 3 src/TapkuLibrary/TKAppDelegate.h
  42. +51 11 src/TapkuLibrary/TKAppDelegate.m
  43. +6 14 src/TapkuLibrary/TKButtonCell.m
  44. +28 28 src/TapkuLibrary/TKCalendarDayEventView.h
  45. +82 122 src/TapkuLibrary/TKCalendarDayEventView.m
  46. +0 101 src/TapkuLibrary/TKCalendarDayTimelineView.h
  47. +0 659 src/TapkuLibrary/TKCalendarDayTimelineView.m
  48. +102 0 src/TapkuLibrary/TKCalendarDayView.h
  49. +806 0 src/TapkuLibrary/TKCalendarDayView.m
  50. +7 5 src/TapkuLibrary/TKCalendarDayViewController.h
  51. +18 45 src/TapkuLibrary/TKCalendarDayViewController.m
  52. +1 1  src/TapkuLibrary/TKCalendarMonthTableViewController.h
  53. +2 2 src/TapkuLibrary/TKCalendarMonthTableViewController.m
  54. +20 12 src/TapkuLibrary/TKCalendarMonthView.h
  55. +207 188 src/TapkuLibrary/TKCalendarMonthView.m
  56. +15 2 src/TapkuLibrary/TKCalendarMonthViewController.h
  57. +26 15 src/TapkuLibrary/TKCalendarMonthViewController.m
  58. +4 4 src/TapkuLibrary/TKCoverflowView.h
  59. +13 29 src/TapkuLibrary/TKCoverflowView.m
  60. +4 4 src/TapkuLibrary/TKEmptyView.h
  61. +7 28 src/TapkuLibrary/TKEmptyView.m
  62. +35 9 src/TapkuLibrary/TKGlobal.h
  63. +5 5 src/TapkuLibrary/TKGradientView.h
  64. +15 25 src/TapkuLibrary/TKHTTPRequest.h
  65. +23 48 src/TapkuLibrary/TKHTTPRequest.m
  66. +5 10 src/TapkuLibrary/TKImageCache.h
  67. +15 20 src/TapkuLibrary/TKImageCache.m
  68. +1 1  src/TapkuLibrary/TKLabelCell.h
  69. +1 1  src/TapkuLibrary/TKLabelFieldCell.h
  70. +1 1  src/TapkuLibrary/TKLabelSwitchCell.h
  71. +1 1  src/TapkuLibrary/TKLabelTextFieldCell.h
  72. +1 0  src/TapkuLibrary/TKLabelTextFieldCell.m
  73. +1 1  src/TapkuLibrary/TKLabelTextViewCell.h
  74. +5 4 src/TapkuLibrary/TKLabelTextViewCell.m
  75. +1 10 src/TapkuLibrary/TKNetworkQueue.m
  76. +2 2 src/TapkuLibrary/TKProgressAlertView.h
  77. +13 22 src/TapkuLibrary/TKProgressAlertView.m
  78. +1 1  src/TapkuLibrary/TKProgressBarView.h
  79. +1 1  src/TapkuLibrary/TKProgressCircleView.h
  80. +0 18 src/TapkuLibrary/TKProgressCircleView.m
  81. +1 1  src/TapkuLibrary/TKSwitchCell.h
  82. +0 1  src/TapkuLibrary/TKSwitchCell.m
  83. +4 4 src/TapkuLibrary/TKTableViewController.h
  84. +19 20 src/TapkuLibrary/TKTableViewController.m
  85. +8 9 src/TapkuLibrary/TKTextViewCell.m
  86. +15 14 src/TapkuLibrary/TKViewController.m
  87. +0 76 src/TapkuLibrary/TapDetectingView.h
  88. +0 182 src/TapkuLibrary/TapDetectingView.m
  89. +1 0  src/TapkuLibrary/UIView+TKCategory.h
  90. +1 1  src/TapkuLibrary/UIView+TKCategory.m
  91. +5 5 src/Tests/FoundationTests.m
  92. +2 5 src/Tests/NSArrayTests.m
  93. +2 1  src/Tests/NSStringTests.m
  94. +1 1  src/Tests/UIViewTests.m
BIN  demo/Assets/Images/launch_iphone-568h@2x.png
BIN  demo/Assets/Images/launch_iphone.png 100755 → 100644
BIN  demo/Assets/Images/launch_iphone@2x.png
4 demo/Classes/AlertsViewController.m
@@ -31,7 +31,7 @@
31 31
32 32 #import "AlertsViewController.h"
33 33
34   -
  34 +#pragma mark - AlertsViewController
35 35 @implementation AlertsViewController
36 36
37 37 - (id) init{
@@ -43,7 +43,7 @@ - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac
43 43 return YES;
44 44 }
45 45
46   -#pragma mark - View Lifecycle
  46 +#pragma mark View Lifecycle
47 47 - (void) loadView{
48 48 [super loadView];
49 49 self.view.backgroundColor = [UIColor whiteColor];
11 demo/Classes/AppDelegate.h
@@ -36,14 +36,15 @@
36 36
37 37 @class RootViewController;
38 38
  39 +#pragma mark - AppDelegate
39 40 @interface AppDelegate : TKAppDelegate
40 41
41   -@property (nonatomic, strong) RootViewController *root;
42   -@property (nonatomic, strong) UINavigationController *navigationController;
  42 +@property (nonatomic,strong) RootViewController *root;
  43 +@property (nonatomic,strong) UINavigationController *navigationController;
43 44
44   -#pragma mark - iPad
45   -@property (nonatomic, strong) UISplitViewController *splitViewController;
46   -@property (nonatomic, strong) DetailViewController *detail;
  45 +#pragma mark iPad
  46 +@property (nonatomic,strong) UISplitViewController *splitViewController;
  47 +@property (nonatomic,strong) DetailViewController *detail;
47 48
48 49 @end
49 50
33 demo/Classes/AppDelegate.m
@@ -33,11 +33,12 @@
33 33 #import "RootViewController.h"
34 34 #import "DetailViewController.h"
35 35
  36 +#pragma mark - AppDelegate
36 37 @implementation AppDelegate
37 38
38 39
39   -#pragma mark - Application lifecycle
40   -- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  40 +#pragma mark Application lifecycle
  41 +- (void) application:(UIApplication *)application commonInitializationLaunching:(NSDictionary *)launchOptions{
41 42 [super application:application didFinishLaunchingWithOptions:launchOptions];
42 43
43 44 self.root = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped];
@@ -59,43 +60,17 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
59 60 self.window.rootViewController = self.navigationController;
60 61 }
61 62
62   -
63   -
64 63
65   -
66   -
67   -
68   -
69   -
70   -
71   - return YES;
72 64 }
73 65 - (void) applicationWillEnterForeground:(UIApplication *)application {
74 66 [super applicationWillEnterForeground:application];
75   -
  67 + // don't forget to call the super to call applicationDidStartup:
76 68 }
77 69 - (void) applicationDidStartup:(UIApplication *)application{
78 70 // called by didFinishLaunching.. & willEnterForeground
79 71
80 72 }
81 73
82   -- (void) applicationDidEnterBackground:(UIApplication *)application {
83   -
84   -}
85   -- (void) applicationWillTerminate:(UIApplication *)application {
86   -
87   -}
88   -
89   -- (void) applicationWillResignActive:(UIApplication *)application {
90   -
91   -}
92   -- (void) applicationDidBecomeActive:(UIApplication *)application {
93   -
94   -}
95   -
96   -#pragma mark - Memory management
97   -- (void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
98   -}
99 74
100 75
101 76 @end
16 demo/Classes/CalendarDayViewController.h
... ... @@ -0,0 +1,16 @@
  1 +//
  2 +// CalendarDayViewController.h
  3 +// Demo
  4 +//
  5 +// Created by Devin Ross on 3/16/13.
  6 +//
  7 +//
  8 +
  9 +#import <TapkuLibrary/TapkuLibrary.h>
  10 +#import <UIKit/UIKit.h>
  11 +
  12 +@interface CalendarDayViewController : TKCalendarDayViewController
  13 +
  14 +@property (nonatomic,strong) NSArray *data;
  15 +
  16 +@end
75 demo/Classes/CalendarDayViewController.m
... ... @@ -0,0 +1,75 @@
  1 +//
  2 +// CalendarDayViewController.m
  3 +// Demo
  4 +//
  5 +// Created by Devin Ross on 3/16/13.
  6 +//
  7 +//
  8 +
  9 +#import "CalendarDayViewController.h"
  10 +
  11 +@implementation CalendarDayViewController
  12 +
  13 +- (NSUInteger) supportedInterfaceOrientations{
  14 + return UIInterfaceOrientationMaskPortrait;
  15 +}
  16 +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  17 + return UIInterfaceOrientationIsPortrait(interfaceOrientation);
  18 +}
  19 +
  20 +
  21 +
  22 +- (void) viewDidLoad{
  23 + [super viewDidLoad];
  24 +
  25 + self.data = @[
  26 + @[@"Meeting with five random dudes", @"Five Guys", @5, @0, @10, @0],
  27 + @[@"Second ultra mega hypra long text to test again with more", @"", @7, @0, @12, @0],
  28 + @[@"Appointment", @"Dennys", @15, @0, @18, @0],
  29 + @[@"Hamburger Bliss", @"Wendys", @15, @0, @18, @0],
  30 + @[@"Fishy Fishy Fishfelayyyyyyyy", @"McDonalds", @5, @30, @6, @0],
  31 + @[@"Turkey Time...... oh wait", @"Chick-fela", @14, @0, @19, @0],
  32 + @[@"Greet the king at the castle", @"Burger King", @19, @30, @30, @0]];
  33 +
  34 +}
  35 +
  36 +#pragma mark TKCalendarDayViewDelegate
  37 +- (NSArray *) calendarDayTimelineView:(TKCalendarDayView*)calendarDayTimeline eventsForDate:(NSDate *)eventDate{
  38 +
  39 + if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:-24*60*60]] == NSOrderedAscending) return @[];
  40 + if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:24*60*60]] == NSOrderedDescending) return @[];
  41 +
  42 + NSDateComponents *info = [[NSDate date] dateComponentsWithTimeZone:calendarDayTimeline.timeZone];
  43 + info.second = 0;
  44 + NSMutableArray *ret = [NSMutableArray array];
  45 +
  46 + for(NSArray *ar in self.data){
  47 +
  48 + TKCalendarDayEventView *event = [calendarDayTimeline dequeueReusableEventView];
  49 + if(event == nil) event = [TKCalendarDayEventView eventView];
  50 +
  51 + event.identifier = nil;
  52 + event.titleLabel.text = ar[0];
  53 + event.locationLabel.text = ar[1];
  54 +
  55 + info.hour = [ar[2] intValue];
  56 + info.minute = [ar[3] intValue];
  57 + event.startDate = [NSDate dateWithDateComponents:info];
  58 +
  59 + info.hour = [ar[4] intValue];
  60 + info.minute = [ar[5] intValue];
  61 + event.endDate = [NSDate dateWithDateComponents:info];
  62 +
  63 + [ret addObject:event];
  64 +
  65 + }
  66 + return ret;
  67 +
  68 +
  69 +}
  70 +- (void) calendarDayTimelineView:(TKCalendarDayView*)calendarDayTimeline eventViewWasSelected:(TKCalendarDayEventView *)eventView{
  71 + TKLog(@"%@",eventView.titleLabel.text);
  72 +}
  73 +
  74 +
  75 +@end
6 demo/Classes/CalendarMonthViewController.h
@@ -32,11 +32,11 @@
32 32 #import <TapkuLibrary/TapkuLibrary.h>
33 33 #import <UIKit/UIKit.h>
34 34
35   -
  35 +#pragma mark - CalendarMonthViewController
36 36 @interface CalendarMonthViewController : TKCalendarMonthTableViewController
37 37
38   -@property (strong,nonatomic) NSMutableArray *dataArray;
39   -@property (strong,nonatomic) NSMutableDictionary *dataDictionary;
  38 +@property (nonatomic,strong) NSMutableArray *dataArray;
  39 +@property (nonatomic,strong) NSMutableDictionary *dataDictionary;
40 40
41 41 - (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end;
42 42
45 demo/Classes/CalendarMonthViewController.m
@@ -31,19 +31,27 @@
31 31
32 32 #import "CalendarMonthViewController.h"
33 33
34   -
  34 +#pragma mark - CalendarMonthViewController
35 35 @implementation CalendarMonthViewController
36 36
37   -#pragma mark - View Lifecycle
  37 +- (NSUInteger) supportedInterfaceOrientations{
  38 + return UIInterfaceOrientationMaskPortrait;
  39 +}
  40 +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  41 + return UIInterfaceOrientationIsPortrait(interfaceOrientation);
  42 +}
  43 +
  44 +
  45 +#pragma mark View Lifecycle
38 46 - (void) viewDidLoad{
39 47 [super viewDidLoad];
40   - [self.monthView selectDate:[NSDate month]];
41   -
  48 + [self.monthView selectDate:[NSDate date]];
  49 + //[self.monthView selectDate:[NSDate month]];
42 50 }
43 51
44 52
45 53
46   -#pragma mark - MonthView Delegate & DataSource
  54 +#pragma mark MonthView Delegate & DataSource
47 55 - (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate{
48 56 [self generateRandomDataForStartDate:startDate endDate:lastDate];
49 57 return self.dataArray;
@@ -51,8 +59,8 @@ - (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NS
51 59 - (void) calendarMonthView:(TKCalendarMonthView*)monthView didSelectDate:(NSDate*)date{
52 60
53 61 // CHANGE THE DATE TO YOUR TIMEZONE
54   - TKDateInformation info = [date dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
55   - NSDate *myTimeZoneDay = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone systemTimeZone]];
  62 + NSDateComponents *info = [date dateComponentsWithTimeZone:monthView.timeZone];
  63 + NSDate *myTimeZoneDay = [NSDate dateWithDateComponents:info];
56 64
57 65 NSLog(@"Date Selected: %@",myTimeZoneDay);
58 66
@@ -64,13 +72,12 @@ - (void) calendarMonthView:(TKCalendarMonthView*)mv monthDidChange:(NSDate*)d an
64 72 }
65 73
66 74
67   -#pragma mark - UITableView Delegate & DataSource
  75 +#pragma mark UITableView Delegate & DataSource
68 76 - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
69 77 return 1;
70   -
71 78 }
72 79 - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
73   - NSArray *ar = [self.dataDictionary objectForKey:[self.monthView dateSelected]];
  80 + NSArray *ar = self.dataDictionary[[self.monthView dateSelected]];
74 81 if(ar == nil) return 0;
75 82 return [ar count];
76 83 }
@@ -82,8 +89,8 @@ - (UITableViewCell *) tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndex
82 89
83 90
84 91
85   - NSArray *ar = [self.dataDictionary objectForKey:[self.monthView dateSelected]];
86   - cell.textLabel.text = [ar objectAtIndex:indexPath.row];
  92 + NSArray *ar = self.dataDictionary[[self.monthView dateSelected]];
  93 + cell.textLabel.text = ar[indexPath.row];
87 94
88 95 return cell;
89 96
@@ -106,20 +113,20 @@ - (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end{
106 113
107 114 int r = arc4random();
108 115 if(r % 3==1){
109   - [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",@"Item two",nil] forKey:d];
110   - [self.dataArray addObject:[NSNumber numberWithBool:YES]];
  116 + [self.dataDictionary setObject:@[@"Item one",@"Item two"] forKey:d];
  117 + [self.dataArray addObject:@YES];
111 118
112 119 }else if(r%4==1){
113   - [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",nil] forKey:d];
114   - [self.dataArray addObject:[NSNumber numberWithBool:YES]];
  120 + [self.dataDictionary setObject:@[@"Item one"] forKey:d];
  121 + [self.dataArray addObject:@YES];
115 122
116 123 }else
117   - [self.dataArray addObject:[NSNumber numberWithBool:NO]];
  124 + [self.dataArray addObject:@NO];
118 125
119 126
120   - TKDateInformation info = [d dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
  127 + NSDateComponents *info = [d dateComponentsWithTimeZone:self.monthView.timeZone];
121 128 info.day++;
122   - d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
  129 + d = [NSDate dateWithDateComponents:info];
123 130 if([d compare:end]==NSOrderedDescending) break;
124 131 }
125 132
12 demo/Classes/CoverflowViewController.h
@@ -31,15 +31,11 @@
31 31 #import <UIKit/UIKit.h>
32 32 #import <TapkuLibrary/TapkuLibrary.h>
33 33
  34 +#pragma mark - CoverflowViewController
  35 +@interface CoverflowViewController : UIViewController <TKCoverflowViewDataSource,TKCoverflowViewDelegate>
34 36
35   -
36   -
37   -@interface CoverflowViewController : UIViewController <TKCoverflowViewDataSource,TKCoverflowViewDelegate> {
38   - BOOL collapsed;
39   -}
40   -
41   -@property (strong,nonatomic) TKCoverflowView *coverflow;
42   -@property (strong,nonatomic) NSArray *covers;
  37 +@property (nonatomic,strong) TKCoverflowView *coverflow;
  38 +@property (nonatomic,strong) NSArray *covers;
43 39
44 40 @end
45 41
48 demo/Classes/CoverflowViewController.m
@@ -30,6 +30,7 @@
30 30 */
31 31 #import "CoverflowViewController.h"
32 32
  33 +#pragma mark - CoverflowViewController
33 34 @implementation CoverflowViewController
34 35
35 36 - (NSUInteger) supportedInterfaceOrientations{
@@ -42,7 +43,7 @@ - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac
42 43 }
43 44
44 45
45   -#pragma mark - View Lifecycle
  46 +#pragma mark View Lifecycle
46 47 - (void) loadView{
47 48
48 49 CGRect rect = [UIScreen mainScreen].bounds;
@@ -86,10 +87,7 @@ - (void) loadView{
86 87
87 88
88 89 UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"Tap Me" style:UIBarButtonItemStyleBordered target:self action:@selector(info)];
89   -
90   -
91   -
92   - self.toolbarItems = @[item];
  90 + self.toolbarItems = @[item];
93 91
94 92
95 93
@@ -185,44 +183,6 @@ - (void) info{
185 183
186 184 }
187 185
188   -
189   -/*
190   -
191   -- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasBroughtToFront:(int)index{
192   - NSLog(@"Front %d",index);
193   -}
194   -- (TKCoverflowCoverView*) coverflowView:(TKCoverflowView*)coverflowView coverAtIndex:(int)index{
195   -
196   - TKCoverflowCoverView *cover = [coverflowView dequeueReusableCoverView];
197   -
198   - if(cover == nil){
199   - BOOL phone = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone;
200   - CGRect rect = phone ? CGRectMake(0, 0, 224, 300) : CGRectMake(0, 0, 300, 600);
201   - cover = [[TKCoverflowCoverView alloc] initWithFrame:rect]; // 224
202   - cover.baseline = 224;
203   - }
204   - cover.image = [self.covers objectAtIndex:index%[self.covers count]];
205   -
206   - return cover;
207   -}
208   -
209   -- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasTappedInFront:(int)index tapCount:(NSInteger)tapCount{
210   -
211   - TKLog(@"Index: %d",index);
212   -
213   - if(tapCount<2) return;
214   -
215   - TKCoverflowCoverView *cover = [coverflowView coverAtIndex:index];
216   - if(cover == nil) return;
217   - [UIView beginAnimations:nil context:nil];
218   - [UIView setAnimationDuration:1];
219   - [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:cover cache:YES];
220   - [UIView commitAnimations];
221   -
222   -}
223   -
224   - */
225   -
226 186 - (NSInteger) numberOfCoversInCoverflowView:(TKCoverflowView *)coverflowView{
227 187 return 20;
228 188 }
@@ -235,7 +195,7 @@ - (TKCoverflowCoverView *) coverflowView:(TKCoverflowView *)coverflowView coverF
235 195
236 196 cover = [[TKCoverflowCoverView alloc] initWithFrame:rect reflection:YES]; // 224
237 197 }
238   - cover.image = [self.covers objectAtIndex:index%[self.covers count]];
  198 + cover.image = self.covers[index%[self.covers count]];
239 199 return cover;
240 200
241 201 }
4 demo/Classes/DetailViewController.h
@@ -31,11 +31,11 @@
31 31
32 32
33 33 #import <UIKit/UIKit.h>
34   -
  34 +#import <TapkuLibrary/TapkuLibrary.h>
35 35
36 36 @interface DetailViewController : UIViewController <UISplitViewControllerDelegate>
37 37
38   -@property (strong,nonatomic) UIToolbar *toolbar;
  38 +@property (nonatomic,strong) UIToolbar *toolbar;
39 39 @property (nonatomic,strong) UIViewController *mainController;
40 40 @property (nonatomic,strong) UIPopoverController *currentPopoverController;
41 41
21 demo/Classes/DetailViewController.m
@@ -31,23 +31,20 @@
31 31
32 32 #import "DetailViewController.h"
33 33
34   -
35   -
  34 +#pragma mark - DetailViewController
36 35 @implementation DetailViewController
37 36
38   -
39 37 - (void) viewDidLoad {
40 38 [super viewDidLoad];
41 39
42 40 self.view.backgroundColor = [UIColor whiteColor];
43 41
44   - self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)];
  42 + self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMakeWithPoint(CGPointZero, self.view.bounds.size.width, 44)];
45 43 self.toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
46 44 self.toolbar.items = [NSArray array];
47 45 [self.view addSubview:self.toolbar];
48 46 }
49 47
50   -
51 48 - (void) setupWithMainController:(UIViewController*)controller{
52 49 [self.mainController.view removeFromSuperview];
53 50 self.mainController = controller;
@@ -64,7 +61,7 @@ - (void) setupWithMainController:(UIViewController*)controller{
64 61
65 62 if(self.currentPopoverController!=nil){
66 63
67   - UIBarButtonItem *item = [[self.toolbar items] objectAtIndex:0];
  64 + UIBarButtonItem *item = [self.toolbar items][0];
68 65
69 66
70 67 NSMutableArray *items = [NSMutableArray array];
@@ -80,8 +77,6 @@ - (void) setupWithMainController:(UIViewController*)controller{
80 77 [self.toolbar setItems:self.mainController.toolbarItems];
81 78 }
82 79
83   -
84   -
85 80 }
86 81 - (void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
87 82
@@ -94,8 +89,6 @@ - (void) splitViewController: (UISplitViewController*)svc willHideViewController
94 89 }
95 90 - (void) splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
96 91
97   -
98   -
99 92 NSMutableArray *items = [[self.toolbar items] mutableCopy];
100 93 [items removeObjectAtIndex:0];
101 94 [self.toolbar setItems:items animated:YES];
@@ -103,7 +96,7 @@ - (void) splitViewController: (UISplitViewController*)svc willShowViewController
103 96
104 97 }
105 98
106   -
  99 +#pragma mark TableView Delegate & Data Source
107 100 - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
108 101 return 0;
109 102 }
@@ -134,12 +127,8 @@ - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
134 127 */
135 128 }
136 129
137   -
138   -
139 130 - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
140 131 return YES;
141 132 }
142 133
143   -
144   -@end
145   -
  134 +@end
2  demo/Classes/EmptyViewController.m
@@ -33,7 +33,7 @@
33 33
34 34 @implementation EmptyViewController
35 35
36   -#pragma mark - View Lifecycle
  36 +#pragma mark View Lifecycle
37 37 - (void) loadView{
38 38 [super loadView];
39 39 self.title = @"Empty";
8 demo/Classes/HUDViewController.h
@@ -34,9 +34,9 @@
34 34
35 35 @interface HUDViewController : UIViewController
36 36
37   -@property (strong,nonatomic) TKProgressBarView *progressBar;
38   -@property (strong,nonatomic) TKProgressBarView *progressBarAlternative;
39   -@property (strong,nonatomic) TKProgressAlertView *alertView;
40   -@property (strong,nonatomic) TKProgressCircleView *progressCircle;
  37 +@property (nonatomic,strong) TKProgressBarView *progressBar;
  38 +@property (nonatomic,strong) TKProgressBarView *progressBarAlternative;
  39 +@property (nonatomic,strong) TKProgressAlertView *alertView;
  40 +@property (nonatomic,strong) TKProgressCircleView *progressCircle;
41 41
42 42 @end
34 demo/Classes/HUDViewController.m
@@ -77,7 +77,7 @@ - (void) stepThree{
77 77 }
78 78
79 79
80   -#pragma mark - View Lifecycle
  80 +#pragma mark View Lifecycle
81 81 - (void) loadView{
82 82 [super loadView];
83 83 self.view.backgroundColor = [UIColor colorWithWhite:0.7 alpha:1];
@@ -105,32 +105,32 @@ - (void) viewDidAppear:(BOOL)animated{
105 105
106 106
107 107
108   -#pragma mark - Properties
  108 +#pragma mark Properties
109 109 - (TKProgressBarView *) progressBar{
110   - if(_progressBar==nil){
111   - _progressBar = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleShort];
112   - _progressBar.center = CGPointMake(self.view.bounds.size.width/2, 220);
113   - }
  110 + if(_progressBar) return _progressBar;
  111 +
  112 + _progressBar = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleShort];
  113 + _progressBar.center = CGPointMake(self.view.bounds.size.width/2, 220);
114 114 return _progressBar;
115 115 }
116 116 - (TKProgressBarView *) progressBarAlternative{
117   - if(_progressBarAlternative==nil){
118   - _progressBarAlternative = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleLong];
119   - _progressBarAlternative.center = CGPointMake(self.view.bounds.size.width/2, 320);
120   - }
  117 + if(_progressBarAlternative) return _progressBarAlternative;
  118 +
  119 + _progressBarAlternative = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleLong];
  120 + _progressBarAlternative.center = CGPointMake(self.view.bounds.size.width/2, 320);
121 121 return _progressBarAlternative;
122 122 }
123 123 - (TKProgressAlertView *) alertView{
124   - if(_alertView==nil){
125   - _alertView = [[TKProgressAlertView alloc] initWithProgressTitle:@"Loading important stuff!"];
126   - }
  124 + if(_alertView) return _alertView;
  125 +
  126 + _alertView = [[TKProgressAlertView alloc] initWithProgressTitle:@"Loading important stuff!"];
127 127 return _alertView;
128 128 }
129 129 - (TKProgressCircleView *) progressCircle{
130   - if(_progressCircle==nil){
131   - _progressCircle = [[TKProgressCircleView alloc] init];
132   - _progressCircle.center = CGPointMake(self.view.bounds.size.width/2, 120);
133   - }
  130 + if(_progressCircle) return _progressCircle;
  131 +
  132 + _progressCircle = [[TKProgressCircleView alloc] init];
  133 + _progressCircle.center = CGPointMake(self.view.bounds.size.width/2, 120);
134 134 return _progressCircle;
135 135 }
136 136
14 demo/Classes/ImageCenterViewController.m
@@ -66,7 +66,7 @@ - (void) newImageRetrieved:(NSNotification*)sender{
66 66
67 67
68 68 NSDictionary *dict = [sender userInfo];
69   - NSInteger tag = [[dict objectForKey:@"tag"] intValue];
  69 + NSInteger tag = [dict[@"tag"] intValue];
70 70 NSArray *paths = [self.tableView indexPathsForVisibleRows];
71 71
72 72
@@ -78,10 +78,8 @@ - (void) newImageRetrieved:(NSNotification*)sender{
78 78
79 79 UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path];
80 80 if(cell.imageView.image == nil && tag == index){
81   -
82   - cell.imageView.image = [dict objectForKey:@"image"];
  81 + cell.imageView.image = dict[@"image"];
83 82 [cell setNeedsLayout];
84   -
85 83 }
86 84
87 85
@@ -91,13 +89,13 @@ - (void) newImageRetrieved:(NSNotification*)sender{
91 89 }
92 90
93 91
94   -#pragma mark - View Lifecycle
  92 +#pragma mark View Lifecycle
95 93 - (void) loadView{
96 94 [super loadView];
97 95 self.tableView.rowHeight = 120;
98 96 self.tableView.allowsSelection = NO;
99 97
100   - UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,100)];
  98 + UIView *v = [[UIView alloc] initWithFrame:CGRectMakeWithPoint(CGPointZero,320,100)];
101 99
102 100 UILabel *lab = [[UILabel alloc] initWithFrame:CGRectInset(v.bounds, 20, 20)];
103 101 lab.text = @"The image cache handles large amounts of network image requests. Good for things like twitter avatars.";
@@ -112,7 +110,7 @@ - (void) loadView{
112 110 }
113 111
114 112
115   -#pragma mark - TableView Delegate & DataSource
  113 +#pragma mark TableView Delegate & DataSource
116 114 - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
117 115 return 1;
118 116 }
@@ -132,7 +130,7 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(
132 130 int i = indexPath.row;
133 131 int index = i % [self.urlArray count];
134 132
135   - NSURL *url = [NSURL URLWithString:[self.urlArray objectAtIndex:index]];
  133 + NSURL *url = [NSURL URLWithString:self.urlArray[index]];
136 134
137 135
138 136 UIImage *img = [self.imageCache imageForKey:[NSString stringWithFormat:@"%d",index] url:url queueIfNeeded:YES tag:index];
6 demo/Classes/LabelViewController.m
@@ -38,7 +38,7 @@ - (id) init{
38 38 return self;
39 39 }
40 40
41   -#pragma mark - View Lifecycle
  41 +#pragma mark View Lifecycle
42 42 - (void) loadView{
43 43 [super loadView];
44 44 self.navigationItem.rightBarButtonItem = self.editButtonItem;
@@ -64,7 +64,7 @@ - (void) loadView{
64 64
65 65 }
66 66
67   -#pragma mark - UITableView Delegate & DataSource
  67 +#pragma mark UITableView Delegate & DataSource
68 68 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
69 69 return 1;
70 70 }
@@ -72,7 +72,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
72 72 return [self.cells count];
73 73 }
74 74 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
75   - return [self.cells objectAtIndex:indexPath.row];
  75 + return self.cells[indexPath.row];
76 76 }
77 77 - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
78 78 return indexPath.row == 1 ? 120 : 44;
11 demo/Classes/MoreCellsViewController.h
@@ -32,11 +32,12 @@
32 32 #import <UIKit/UIKit.h>
33 33 #import <TapkuLibrary/TapkuLibrary.h>
34 34
  35 +#pragma mark - MoreCellsViewController
  36 +@interface MoreCellsViewController : UITableViewController
  37 +
  38 +@property (nonatomic,strong) TKButtonCell *buttonCell;
  39 +@property (nonatomic,strong) TKSwitchCell *switchCell;
  40 +@property (nonatomic,strong) TKTextViewCell *textViewCell;
35 41
36   -@interface MoreCellsViewController : UITableViewController {
37   - TKButtonCell *buttonCell;
38   - TKSwitchCell *switchCell;
39   - TKTextViewCell *textViewCell;
40   -}
41 42
42 43 @end
22 demo/Classes/MoreCellsViewController.m
@@ -39,22 +39,22 @@ - (id) init{
39 39 }
40 40
41 41
42   -#pragma mark - View Lifecycle
  42 +#pragma mark View Lifecycle
43 43 - (void) loadView{
44 44 [super loadView];
45 45
46   - buttonCell = [[TKButtonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"button"];
47   - buttonCell.textLabel.text = @"This is a BUTTON Cell";
  46 + self.buttonCell = [[TKButtonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"button"];
  47 + self.buttonCell.textLabel.text = @"This is a BUTTON Cell";
48 48
49   - switchCell = [[TKSwitchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
50   - switchCell.textLabel.text = @"Switch Cell";
  49 + self.switchCell = [[TKSwitchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
  50 + self.switchCell.textLabel.text = @"Switch Cell";
51 51
52   - textViewCell = [[TKTextViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
53   - textViewCell.textView.text = @"TextView Cell - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent blandit malesuada turpis quis egestas. Curabitur varius nunc nec leo tincidunt mattis. Cras malesuada euismod lobortis. Praesent ultrices malesuada lorem et convallis. Pellentesque hendrerit lectus eget felis rutrum vel volutpat nisl semper. Suspendisse consectetur sem eu arcu ullamcorper ut cursus est fringilla. Suspendisse blandit rhoncus nisi ac lacinia. Curabitur vestibulum mattis eros a accumsan. Morbi pulvinar consequat hendrerit. In hac habitasse platea dictumst. Mauris euismod convallis faucibus. Morbi faucibus ultricies elit, ac ullamcorper ipsum accumsan et.";
  52 + self.textViewCell = [[TKTextViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
  53 + self.textViewCell.textView.text = @"TextView Cell - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent blandit malesuada turpis quis egestas. Curabitur varius nunc nec leo tincidunt mattis. Cras malesuada euismod lobortis. Praesent ultrices malesuada lorem et convallis. Pellentesque hendrerit lectus eget felis rutrum vel volutpat nisl semper. Suspendisse consectetur sem eu arcu ullamcorper ut cursus est fringilla. Suspendisse blandit rhoncus nisi ac lacinia. Curabitur vestibulum mattis eros a accumsan. Morbi pulvinar consequat hendrerit. In hac habitasse platea dictumst. Mauris euismod convallis faucibus. Morbi faucibus ultricies elit, ac ullamcorper ipsum accumsan et.";
54 54
55 55 }
56 56
57   -#pragma mark - UITableView Delegate & DataSource
  57 +#pragma mark UITableView Delegate & DataSource
58 58 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
59 59 return 3;
60 60 }
@@ -67,13 +67,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
67 67
68 68 switch (indexPath.section) {
69 69 case 0:
70   - cell = buttonCell;
  70 + cell = self.buttonCell;
71 71 break;
72 72 case 1:
73   - cell = switchCell;
  73 + cell = self.switchCell;
74 74 break;
75 75 default:
76   - cell = textViewCell;
  76 + cell = self.textViewCell;
77 77 break;
78 78 }
79 79
3  demo/Classes/NetworkRequestViewController.h → demo/Classes/NetworkRequestProgressViewController.h
@@ -32,9 +32,8 @@
32 32 #import <UIKit/UIKit.h>
33 33 #import <TapkuLibrary/TapkuLibrary.h>
34 34
35   -@interface NetworkRequestViewController : TKViewController <TKHTTPRequestProgressDelegate>
  35 +@interface NetworkRequestProgressViewController : TKViewController <TKHTTPRequestProgressDelegate>
36 36
37   -@property (nonatomic,strong) UITextView *textView;
38 37 @property (nonatomic,strong) TKProgressCircleView *circle;
39 38
40 39 @end
55 demo/Classes/NetworkRequestViewController.m → demo/Classes/NetworkRequestProgressViewController.m
@@ -29,9 +29,9 @@
29 29
30 30 */
31 31
32   -#import "NetworkRequestViewController.h"
  32 +#import "NetworkRequestProgressViewController.h"
33 33
34   -@implementation NetworkRequestViewController
  34 +@implementation NetworkRequestProgressViewController
35 35
36 36 - (id) init{
37 37 if(!(self=[super init])) return nil;
@@ -40,21 +40,15 @@ - (id) init{
40 40
41 41 - (void) loadView{
42 42 [super loadView];
43   - self.view.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1];
  43 + self.view.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];
  44 +
44 45
45   - CGRect r = CGRectInset(self.view.bounds, 10, 10);
46   - r.size.height -= 80;
47   - self.textView = [[UITextView alloc] initWithFrame:r];
48   - self.textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
49   - self.textView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
50   - self.textView.editable = NO;
51   - [self.view addSubview:self.textView];
52 46
53   - CGFloat y = r.size.height + r.origin.y;
54   - CGFloat h = self.view.bounds.size.height - y;
  47 + CGFloat y = self.view.bounds.size.height/2.0;
  48 + CGFloat x = self.view.bounds.size.width/2.0;
55 49
56 50 self.circle = [[TKProgressCircleView alloc] init];
57   - self.circle.center = CGPointMake(self.view.bounds.size.width/2, y + h / 2 );
  51 + self.circle.center = CGPointMake(x,y);
58 52 self.circle.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
59 53 [self.circle roundOffFrame];
60 54 [self.view addSubview:self.circle];
@@ -73,7 +67,7 @@ - (void) loadView{
73 67
74 68 - (void) start{
75 69
76   - __weak TKHTTPRequest *req = [TKHTTPRequest requestWithURL:[NSURL URLWithString:@"http://api.dribbble.com/shots/everyone?per_page=30"]];
  70 + __weak TKHTTPRequest *req = [TKHTTPRequest requestWithURL:[NSURL URLWithString:@"http://devinsheaven.com/tapkulibrary.zip"]];
77 71 req.delegate = self;
78 72 req.didFinishSelector = @selector(networkRequestDidFinish:);
79 73 req.progressDelegate = self;
@@ -85,35 +79,18 @@ - (void) start{
85 79 }
86 80
87 81 - (void) request:(TKHTTPRequest*)request didReceiveTotalBytes:(NSInteger)received ofExpectedBytes:(NSInteger)total{
88   - [self.circle setProgress:received/total animated:YES];
  82 +
  83 + CGFloat percentage = (CGFloat)received / (CGFloat)total;
  84 + NSLog(@"Received... %d of %d (%d%%)",received,total,(NSInteger)(percentage*100));
  85 + [self.circle setProgress:percentage animated:YES];
89 86 }
90 87 - (void) networkRequestDidFinish:(TKHTTPRequest*)request{
91   -
92   - NSLog(@"Finished... %@",request);
93 88 NSData *data = [request responseData];
94   -
95   - if(data)
96   - [self processJSONDataInBackground:data
97   - withCallbackSelector:@selector(processedData:)
98   - backgroundSelector:@selector(putJsonIntoObjects:)
99   - errorSelector:@selector(parseError:)
100   - readingOptions:0];
101   -
102   -
103   -
104   -}
105 89
106   -- (void) parseError:(NSError*)error{
107   - NSLog(@"ERROR: %@",error);
108   -}
109   -- (void) processedData:(NSDictionary*)dict{
110   -
111   - if(self.textView.text==nil || self.textView.text.length < 1)
112   - [self.textView setText:[dict description]];
113   -
114   -}
115   -- (id) putJsonIntoObjects:(NSDictionary*)dictionary{
116   - return dictionary; // we'll just pass back the json dictionary for now
  90 + NSLog(@"Finished... %@ (length %d)",request,data.length);
  91 +
117 92 }
118 93
  94 +
  95 +
119 96 @end
4 demo/Classes/RootViewController.h
@@ -33,11 +33,9 @@
33 33 #import <TapkuLibrary/TapkuLibrary.h>
34 34 @class DetailViewController;
35 35
36   -
37 36 @interface RootViewController : TKTableViewController
38 37
39 38 @property (nonatomic,strong) NSArray *data;
40 39 @property (nonatomic,strong) DetailViewController *detailViewController;
41 40
42   -
43   -@end
  41 +@end
69 demo/Classes/RootViewController.m
@@ -41,7 +41,26 @@
41 41 #import "MoreCellsViewController.h"
42 42 #import "AlertsViewController.h"
43 43 #import "ImageCenterViewController.h"
44   -#import "NetworkRequestViewController.h"
  44 +#import "NetworkRequestProgressViewController.h"
  45 +#import "CalendarDayViewController.h"
  46 +
  47 +
  48 +@interface UINavigationController (Rotation_IOS6)
  49 +@end
  50 +
  51 +@implementation UINavigationController (Rotation_IOS6)
  52 +
  53 +- (BOOL) shouldAutorotate{
  54 + return [[self.viewControllers lastObject] shouldAutorotate];
  55 +}
  56 +- (NSUInteger) supportedInterfaceOrientations{
  57 + return [[self.viewControllers lastObject] supportedInterfaceOrientations];
  58 +}
  59 +- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation{
  60 + return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
  61 +}
  62 +
  63 +@end
45 64
46 65 @implementation RootViewController
47 66
@@ -50,37 +69,32 @@ - (id) initWithStyle:(UITableViewStyle)s{
50 69 self.title = @"Tapku Library";
51 70 return self;
52 71 }
  72 +- (NSUInteger) supportedInterfaceOrientations{
  73 + return [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait;
  74 +}
  75 +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  76 + return [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ? YES : UIInterfaceOrientationIsPortrait(interfaceOrientation) ;
  77 +}
53 78
54 79
55   -#pragma mark - View Lifecycle
  80 +#pragma mark View Lifecycle
56 81 - (void) viewDidLoad{
57 82 [super viewDidLoad];
58 83
59   - NSArray *rows;
60   - NSMutableArray *tmp = [NSMutableArray array];
61   -
62   - rows = @[@"Coverflow",@"Month Grid Calendar"];
63   - [tmp addObject:@{@"rows" : rows, @"title" : @"Views"}];
64   -
65   - rows = @[@"Empty Sign",@"Loading HUD",@"Alerts"];
66   - [tmp addObject:@{@"rows" : rows, @"title" : @"UI Elements"}];
67   -
68   - rows = @[@"Label Cells",@"More Cells"];
69   - [tmp addObject:@{@"rows" : rows, @"title" : @"Table View Cells"}];
70   -
71   - rows = @[@"Image Cache",@"HTTP Request"];
72   - [tmp addObject:@{@"rows" : rows, @"title" : @"Network"}];
73   -
74   - self.data = tmp;
  84 + self.data = @[
  85 + @{@"rows" : @[@"Coverflow",@"Month Grid Calendar",@"Day Calendar"], @"title" : @"Views"},
  86 + @{@"rows" : @[@"Empty Sign",@"Loading HUD",@"Alerts"], @"title" : @"UI Elements"},
  87 + @{@"rows" : @[@"Label Cells",@"More Cells"], @"title" : @"Table View Cells"},
  88 + @{@"rows" : @[@"Image Cache",@"HTTP Request Progress"], @"title" : @"Network"}];
75 89 }
76 90
77 91
78   -#pragma mark - UITableView Delegate & DataSource
  92 +#pragma mark UITableView Delegate & DataSource
79 93 - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
80 94 return [self.data count];
81 95 }
82 96 - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
83   - return [[[self.data objectAtIndex:section] objectForKey:@"rows"] count];
  97 + return [self.data[section][@"rows"] count];
84 98 }
85 99 - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
86 100
@@ -90,7 +104,7 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(
90 104 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
91 105 }
92 106
93   - cell.textLabel.text = [[[self.data objectAtIndex:indexPath.section] objectForKey:@"rows"] objectAtIndex:indexPath.row];
  107 + cell.textLabel.text = self.data[indexPath.section][@"rows"][indexPath.row];
94 108 cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
95 109
96 110 return cell;
@@ -101,7 +115,7 @@ - (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)inde
101 115 UIViewController *vc;
102 116 int s = indexPath.section, r = indexPath.row;
103 117
104   - if(s==0 && r < 1){
  118 + if(s==0 && r == 0){
105 119 vc = [[CoverflowViewController alloc] init];
106 120
107 121 if(self.detailViewController)
@@ -115,6 +129,9 @@ - (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)inde
115 129 }else if(s==0 && r==1)
116 130 vc = [[CalendarMonthViewController alloc] initWithSunday:YES];
117 131
  132 + else if(s==0 && r==2)
  133 + vc = [[CalendarDayViewController alloc] init];
  134 +
118 135 else if(s==1 && r==0)
119 136 vc = [[EmptyViewController alloc] init];
120 137 else if(s==1 && r==1)
@@ -130,20 +147,20 @@ - (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)inde
130 147 else if(s==3 && r==0)
131 148 vc = [[ImageCenterViewController alloc] init];
132 149 else
133   - vc = [[NetworkRequestViewController alloc] init];
  150 + vc = [[NetworkRequestProgressViewController alloc] init];
134 151
135 152
136   - if(self.detailViewController && !(s==0 && r==1))
  153 + if(self.detailViewController && !(s==0))
137 154 [self.detailViewController setupWithMainController:vc];
138 155 else
139 156 [self.navigationController pushViewController:vc animated:YES];
140 157
141 158 }
142 159 - (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
143   - return [[self.data objectAtIndex:section] objectForKey:@"title"];
  160 + return self.data[section][@"title"];
144 161 }
145 162 - (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
146   - return [[self.data objectAtIndex:section] objectForKey:@"footer"];
  163 + return self.data[section][@"footer"];
147 164 }
148 165
149 166 @end
10 demo/Demo-Info.plist
@@ -32,6 +32,16 @@
32 32 <string>launch_iphone.png</string>
33 33 <key>UIPrerenderedIcon</key>
34 34 <true/>
  35 + <key>UIStatusBarTintParameters</key>
  36 + <dict>
  37 + <key>UINavigationBar</key>
  38 + <dict>
  39 + <key>Style</key>
  40 + <string>UIBarStyleDefault</string>
  41 + <key>Translucent</key>
  42 + <false/>
  43 + </dict>
  44 + </dict>
35 45 <key>UISupportedInterfaceOrientations</key>
36 46 <array>
37 47 <string>UIInterfaceOrientationPortrait</string>
30 demo/Demo.xcodeproj/project.pbxproj
@@ -9,6 +9,8 @@
9 9 /* Begin PBXBuildFile section */
10 10 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
11 11 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
  12 + 200908B616F627F60012DC4F /* launch_iphone@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 200908B516F627F60012DC4F /* launch_iphone@2x.png */; };
  13 + 200908BB16F6561D0012DC4F /* TapkuLibrary.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 200908BA16F6561D0012DC4F /* TapkuLibrary.bundle */; };
12 14 2052AF6C168B83C600A49526 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF6B168B83C600A49526 /* main.m */; };
13 15 2052AF88168B83E900A49526 /* AlertsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF6F168B83E900A49526 /* AlertsViewController.m */; };
14 16 2052AF89168B83E900A49526 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF71168B83E900A49526 /* AppDelegate.m */; };
@@ -20,7 +22,7 @@
20 22 2052AF8F168B83E900A49526 /* ImageCenterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF7D168B83E900A49526 /* ImageCenterViewController.m */; };
21 23 2052AF90168B83E900A49526 /* LabelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF7F168B83E900A49526 /* LabelViewController.m */; };
22 24 2052AF92168B83E900A49526 /* MoreCellsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF83168B83E900A49526 /* MoreCellsViewController.m */; };
23   - 2052AF93168B83E900A49526 /* NetworkRequestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF85168B83E900A49526 /* NetworkRequestViewController.m */; };
  25 + 2052AF93168B83E900A49526 /* NetworkRequestProgressViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF85168B83E900A49526 /* NetworkRequestProgressViewController.m */; };
24 26 2052AF94168B83E900A49526 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF87168B83E900A49526 /* RootViewController.m */; };
25 27