Permalink
Browse files

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...
1 parent 5eeb23e commit 5e488a675101ae35e01b0d2c1f33aee2a9bc2115 @devinross committed Mar 19, 2013
Showing with 2,166 additions and 2,256 deletions.
  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
View
BIN demo/Assets/Images/launch_iphone-568h@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN demo/Assets/Images/launch_iphone.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN demo/Assets/Images/launch_iphone@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 demo/Classes/AlertsViewController.m
@@ -31,7 +31,7 @@
#import "AlertsViewController.h"
-
+#pragma mark - AlertsViewController
@implementation AlertsViewController
- (id) init{
@@ -43,7 +43,7 @@ - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac
return YES;
}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
[super loadView];
self.view.backgroundColor = [UIColor whiteColor];
View
11 demo/Classes/AppDelegate.h
@@ -36,14 +36,15 @@
@class RootViewController;
+#pragma mark - AppDelegate
@interface AppDelegate : TKAppDelegate
-@property (nonatomic, strong) RootViewController *root;
-@property (nonatomic, strong) UINavigationController *navigationController;
+@property (nonatomic,strong) RootViewController *root;
+@property (nonatomic,strong) UINavigationController *navigationController;
-#pragma mark - iPad
-@property (nonatomic, strong) UISplitViewController *splitViewController;
-@property (nonatomic, strong) DetailViewController *detail;
+#pragma mark iPad
+@property (nonatomic,strong) UISplitViewController *splitViewController;
+@property (nonatomic,strong) DetailViewController *detail;
@end
View
33 demo/Classes/AppDelegate.m
@@ -33,11 +33,12 @@
#import "RootViewController.h"
#import "DetailViewController.h"
+#pragma mark - AppDelegate
@implementation AppDelegate
-#pragma mark - Application lifecycle
-- (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+#pragma mark Application lifecycle
+- (void) application:(UIApplication *)application commonInitializationLaunching:(NSDictionary *)launchOptions{
[super application:application didFinishLaunchingWithOptions:launchOptions];
self.root = [[RootViewController alloc] initWithStyle:UITableViewStyleGrouped];
@@ -59,43 +60,17 @@ - (BOOL) application:(UIApplication *)application didFinishLaunchingWithOptions:
self.window.rootViewController = self.navigationController;
}
-
-
-
-
-
-
-
-
- return YES;
}
- (void) applicationWillEnterForeground:(UIApplication *)application {
[super applicationWillEnterForeground:application];
-
+ // don't forget to call the super to call applicationDidStartup:
}
- (void) applicationDidStartup:(UIApplication *)application{
// called by didFinishLaunching.. & willEnterForeground
}
-- (void) applicationDidEnterBackground:(UIApplication *)application {
-
-}
-- (void) applicationWillTerminate:(UIApplication *)application {
-
-}
-
-- (void) applicationWillResignActive:(UIApplication *)application {
-
-}
-- (void) applicationDidBecomeActive:(UIApplication *)application {
-
-}
-
-#pragma mark - Memory management
-- (void) applicationDidReceiveMemoryWarning:(UIApplication *)application {
-}
@end
View
16 demo/Classes/CalendarDayViewController.h
@@ -0,0 +1,16 @@
+//
+// CalendarDayViewController.h
+// Demo
+//
+// Created by Devin Ross on 3/16/13.
+//
+//
+
+#import <TapkuLibrary/TapkuLibrary.h>
+#import <UIKit/UIKit.h>
+
+@interface CalendarDayViewController : TKCalendarDayViewController
+
+@property (nonatomic,strong) NSArray *data;
+
+@end
View
75 demo/Classes/CalendarDayViewController.m
@@ -0,0 +1,75 @@
+//
+// CalendarDayViewController.m
+// Demo
+//
+// Created by Devin Ross on 3/16/13.
+//
+//
+
+#import "CalendarDayViewController.h"
+
+@implementation CalendarDayViewController
+
+- (NSUInteger) supportedInterfaceOrientations{
+ return UIInterfaceOrientationMaskPortrait;
+}
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return UIInterfaceOrientationIsPortrait(interfaceOrientation);
+}
+
+
+
+- (void) viewDidLoad{
+ [super viewDidLoad];
+
+ self.data = @[
+ @[@"Meeting with five random dudes", @"Five Guys", @5, @0, @10, @0],
+ @[@"Second ultra mega hypra long text to test again with more", @"", @7, @0, @12, @0],
+ @[@"Appointment", @"Dennys", @15, @0, @18, @0],
+ @[@"Hamburger Bliss", @"Wendys", @15, @0, @18, @0],
+ @[@"Fishy Fishy Fishfelayyyyyyyy", @"McDonalds", @5, @30, @6, @0],
+ @[@"Turkey Time...... oh wait", @"Chick-fela", @14, @0, @19, @0],
+ @[@"Greet the king at the castle", @"Burger King", @19, @30, @30, @0]];
+
+}
+
+#pragma mark TKCalendarDayViewDelegate
+- (NSArray *) calendarDayTimelineView:(TKCalendarDayView*)calendarDayTimeline eventsForDate:(NSDate *)eventDate{
+
+ if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:-24*60*60]] == NSOrderedAscending) return @[];
+ if([eventDate compare:[NSDate dateWithTimeIntervalSinceNow:24*60*60]] == NSOrderedDescending) return @[];
+
+ NSDateComponents *info = [[NSDate date] dateComponentsWithTimeZone:calendarDayTimeline.timeZone];
+ info.second = 0;
+ NSMutableArray *ret = [NSMutableArray array];
+
+ for(NSArray *ar in self.data){
+
+ TKCalendarDayEventView *event = [calendarDayTimeline dequeueReusableEventView];
+ if(event == nil) event = [TKCalendarDayEventView eventView];
+
+ event.identifier = nil;
+ event.titleLabel.text = ar[0];
+ event.locationLabel.text = ar[1];
+
+ info.hour = [ar[2] intValue];
+ info.minute = [ar[3] intValue];
+ event.startDate = [NSDate dateWithDateComponents:info];
+
+ info.hour = [ar[4] intValue];
+ info.minute = [ar[5] intValue];
+ event.endDate = [NSDate dateWithDateComponents:info];
+
+ [ret addObject:event];
+
+ }
+ return ret;
+
+
+}
+- (void) calendarDayTimelineView:(TKCalendarDayView*)calendarDayTimeline eventViewWasSelected:(TKCalendarDayEventView *)eventView{
+ TKLog(@"%@",eventView.titleLabel.text);
+}
+
+
+@end
View
6 demo/Classes/CalendarMonthViewController.h
@@ -32,11 +32,11 @@
#import <TapkuLibrary/TapkuLibrary.h>
#import <UIKit/UIKit.h>
-
+#pragma mark - CalendarMonthViewController
@interface CalendarMonthViewController : TKCalendarMonthTableViewController
-@property (strong,nonatomic) NSMutableArray *dataArray;
-@property (strong,nonatomic) NSMutableDictionary *dataDictionary;
+@property (nonatomic,strong) NSMutableArray *dataArray;
+@property (nonatomic,strong) NSMutableDictionary *dataDictionary;
- (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end;
View
45 demo/Classes/CalendarMonthViewController.m
@@ -31,28 +31,36 @@
#import "CalendarMonthViewController.h"
-
+#pragma mark - CalendarMonthViewController
@implementation CalendarMonthViewController
-#pragma mark - View Lifecycle
+- (NSUInteger) supportedInterfaceOrientations{
+ return UIInterfaceOrientationMaskPortrait;
+}
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return UIInterfaceOrientationIsPortrait(interfaceOrientation);
+}
+
+
+#pragma mark View Lifecycle
- (void) viewDidLoad{
[super viewDidLoad];
- [self.monthView selectDate:[NSDate month]];
-
+ [self.monthView selectDate:[NSDate date]];
+ //[self.monthView selectDate:[NSDate month]];
}
-#pragma mark - MonthView Delegate & DataSource
+#pragma mark MonthView Delegate & DataSource
- (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate{
[self generateRandomDataForStartDate:startDate endDate:lastDate];
return self.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]];
+ NSDateComponents *info = [date dateComponentsWithTimeZone:monthView.timeZone];
+ NSDate *myTimeZoneDay = [NSDate dateWithDateComponents:info];
NSLog(@"Date Selected: %@",myTimeZoneDay);
@@ -64,13 +72,12 @@ - (void) calendarMonthView:(TKCalendarMonthView*)mv monthDidChange:(NSDate*)d an
}
-#pragma mark - UITableView Delegate & DataSource
+#pragma mark UITableView Delegate & DataSource
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
-
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- NSArray *ar = [self.dataDictionary objectForKey:[self.monthView dateSelected]];
+ NSArray *ar = self.dataDictionary[[self.monthView dateSelected]];
if(ar == nil) return 0;
return [ar count];
}
@@ -82,8 +89,8 @@ - (UITableViewCell *) tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndex
- NSArray *ar = [self.dataDictionary objectForKey:[self.monthView dateSelected]];
- cell.textLabel.text = [ar objectAtIndex:indexPath.row];
+ NSArray *ar = self.dataDictionary[[self.monthView dateSelected]];
+ cell.textLabel.text = ar[indexPath.row];
return cell;
@@ -106,20 +113,20 @@ - (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end{
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]];
+ [self.dataDictionary setObject:@[@"Item one",@"Item two"] forKey:d];
+ [self.dataArray addObject:@YES];
}else if(r%4==1){
- [self.dataDictionary setObject:[NSArray arrayWithObjects:@"Item one",nil] forKey:d];
- [self.dataArray addObject:[NSNumber numberWithBool:YES]];
+ [self.dataDictionary setObject:@[@"Item one"] forKey:d];
+ [self.dataArray addObject:@YES];
}else
- [self.dataArray addObject:[NSNumber numberWithBool:NO]];
+ [self.dataArray addObject:@NO];
- TKDateInformation info = [d dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ NSDateComponents *info = [d dateComponentsWithTimeZone:self.monthView.timeZone];
info.day++;
- d = [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ d = [NSDate dateWithDateComponents:info];
if([d compare:end]==NSOrderedDescending) break;
}
View
12 demo/Classes/CoverflowViewController.h
@@ -31,15 +31,11 @@
#import <UIKit/UIKit.h>
#import <TapkuLibrary/TapkuLibrary.h>
+#pragma mark - CoverflowViewController
+@interface CoverflowViewController : UIViewController <TKCoverflowViewDataSource,TKCoverflowViewDelegate>
-
-
-@interface CoverflowViewController : UIViewController <TKCoverflowViewDataSource,TKCoverflowViewDelegate> {
- BOOL collapsed;
-}
-
-@property (strong,nonatomic) TKCoverflowView *coverflow;
-@property (strong,nonatomic) NSArray *covers;
+@property (nonatomic,strong) TKCoverflowView *coverflow;
+@property (nonatomic,strong) NSArray *covers;
@end
View
48 demo/Classes/CoverflowViewController.m
@@ -30,6 +30,7 @@
*/
#import "CoverflowViewController.h"
+#pragma mark - CoverflowViewController
@implementation CoverflowViewController
- (NSUInteger) supportedInterfaceOrientations{
@@ -42,7 +43,7 @@ - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfac
}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
CGRect rect = [UIScreen mainScreen].bounds;
@@ -86,10 +87,7 @@ - (void) loadView{
UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"Tap Me" style:UIBarButtonItemStyleBordered target:self action:@selector(info)];
-
-
-
- self.toolbarItems = @[item];
+ self.toolbarItems = @[item];
@@ -185,44 +183,6 @@ - (void) info{
}
-
-/*
-
-- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasBroughtToFront:(int)index{
- NSLog(@"Front %d",index);
-}
-- (TKCoverflowCoverView*) coverflowView:(TKCoverflowView*)coverflowView coverAtIndex:(int)index{
-
- TKCoverflowCoverView *cover = [coverflowView dequeueReusableCoverView];
-
- if(cover == nil){
- BOOL phone = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone;
- CGRect rect = phone ? CGRectMake(0, 0, 224, 300) : CGRectMake(0, 0, 300, 600);
- cover = [[TKCoverflowCoverView alloc] initWithFrame:rect]; // 224
- cover.baseline = 224;
- }
- cover.image = [self.covers objectAtIndex:index%[self.covers count]];
-
- return cover;
-}
-
-- (void) coverflowView:(TKCoverflowView*)coverflowView coverAtIndexWasTappedInFront:(int)index tapCount:(NSInteger)tapCount{
-
- TKLog(@"Index: %d",index);
-
- if(tapCount<2) return;
-
- TKCoverflowCoverView *cover = [coverflowView coverAtIndex:index];
- if(cover == nil) return;
- [UIView beginAnimations:nil context:nil];
- [UIView setAnimationDuration:1];
- [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:cover cache:YES];
- [UIView commitAnimations];
-
-}
-
- */
-
- (NSInteger) numberOfCoversInCoverflowView:(TKCoverflowView *)coverflowView{
return 20;
}
@@ -235,7 +195,7 @@ - (TKCoverflowCoverView *) coverflowView:(TKCoverflowView *)coverflowView coverF
cover = [[TKCoverflowCoverView alloc] initWithFrame:rect reflection:YES]; // 224
}
- cover.image = [self.covers objectAtIndex:index%[self.covers count]];
+ cover.image = self.covers[index%[self.covers count]];
return cover;
}
View
4 demo/Classes/DetailViewController.h
@@ -31,11 +31,11 @@
#import <UIKit/UIKit.h>
-
+#import <TapkuLibrary/TapkuLibrary.h>
@interface DetailViewController : UIViewController <UISplitViewControllerDelegate>
-@property (strong,nonatomic) UIToolbar *toolbar;
+@property (nonatomic,strong) UIToolbar *toolbar;
@property (nonatomic,strong) UIViewController *mainController;
@property (nonatomic,strong) UIPopoverController *currentPopoverController;
View
21 demo/Classes/DetailViewController.m
@@ -31,23 +31,20 @@
#import "DetailViewController.h"
-
-
+#pragma mark - DetailViewController
@implementation DetailViewController
-
- (void) viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
- self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)];
+ self.toolbar = [[UIToolbar alloc] initWithFrame:CGRectMakeWithPoint(CGPointZero, self.view.bounds.size.width, 44)];
self.toolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.toolbar.items = [NSArray array];
[self.view addSubview:self.toolbar];
}
-
- (void) setupWithMainController:(UIViewController*)controller{
[self.mainController.view removeFromSuperview];
self.mainController = controller;
@@ -64,7 +61,7 @@ - (void) setupWithMainController:(UIViewController*)controller{
if(self.currentPopoverController!=nil){
- UIBarButtonItem *item = [[self.toolbar items] objectAtIndex:0];
+ UIBarButtonItem *item = [self.toolbar items][0];
NSMutableArray *items = [NSMutableArray array];
@@ -80,8 +77,6 @@ - (void) setupWithMainController:(UIViewController*)controller{
[self.toolbar setItems:self.mainController.toolbarItems];
}
-
-
}
- (void) splitViewController: (UISplitViewController*)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem*)barButtonItem forPopoverController: (UIPopoverController*)pc {
@@ -94,16 +89,14 @@ - (void) splitViewController: (UISplitViewController*)svc willHideViewController
}
- (void) splitViewController: (UISplitViewController*)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem {
-
-
NSMutableArray *items = [[self.toolbar items] mutableCopy];
[items removeObjectAtIndex:0];
[self.toolbar setItems:items animated:YES];
self.currentPopoverController = nil;
}
-
+#pragma mark TableView Delegate & Data Source
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return 0;
}
@@ -134,12 +127,8 @@ - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
*/
}
-
-
- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
-
-@end
-
+@end
View
2 demo/Classes/EmptyViewController.m
@@ -33,7 +33,7 @@
@implementation EmptyViewController
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
[super loadView];
self.title = @"Empty";
View
8 demo/Classes/HUDViewController.h
@@ -34,9 +34,9 @@
@interface HUDViewController : UIViewController
-@property (strong,nonatomic) TKProgressBarView *progressBar;
-@property (strong,nonatomic) TKProgressBarView *progressBarAlternative;
-@property (strong,nonatomic) TKProgressAlertView *alertView;
-@property (strong,nonatomic) TKProgressCircleView *progressCircle;
+@property (nonatomic,strong) TKProgressBarView *progressBar;
+@property (nonatomic,strong) TKProgressBarView *progressBarAlternative;
+@property (nonatomic,strong) TKProgressAlertView *alertView;
+@property (nonatomic,strong) TKProgressCircleView *progressCircle;
@end
View
34 demo/Classes/HUDViewController.m
@@ -77,7 +77,7 @@ - (void) stepThree{
}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
[super loadView];
self.view.backgroundColor = [UIColor colorWithWhite:0.7 alpha:1];
@@ -105,32 +105,32 @@ - (void) viewDidAppear:(BOOL)animated{
-#pragma mark - Properties
+#pragma mark Properties
- (TKProgressBarView *) progressBar{
- if(_progressBar==nil){
- _progressBar = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleShort];
- _progressBar.center = CGPointMake(self.view.bounds.size.width/2, 220);
- }
+ if(_progressBar) return _progressBar;
+
+ _progressBar = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleShort];
+ _progressBar.center = CGPointMake(self.view.bounds.size.width/2, 220);
return _progressBar;
}
- (TKProgressBarView *) progressBarAlternative{
- if(_progressBarAlternative==nil){
- _progressBarAlternative = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleLong];
- _progressBarAlternative.center = CGPointMake(self.view.bounds.size.width/2, 320);
- }
+ if(_progressBarAlternative) return _progressBarAlternative;
+
+ _progressBarAlternative = [[TKProgressBarView alloc] initWithStyle:TKProgressBarViewStyleLong];
+ _progressBarAlternative.center = CGPointMake(self.view.bounds.size.width/2, 320);
return _progressBarAlternative;
}
- (TKProgressAlertView *) alertView{
- if(_alertView==nil){
- _alertView = [[TKProgressAlertView alloc] initWithProgressTitle:@"Loading important stuff!"];
- }
+ if(_alertView) return _alertView;
+
+ _alertView = [[TKProgressAlertView alloc] initWithProgressTitle:@"Loading important stuff!"];
return _alertView;
}
- (TKProgressCircleView *) progressCircle{
- if(_progressCircle==nil){
- _progressCircle = [[TKProgressCircleView alloc] init];
- _progressCircle.center = CGPointMake(self.view.bounds.size.width/2, 120);
- }
+ if(_progressCircle) return _progressCircle;
+
+ _progressCircle = [[TKProgressCircleView alloc] init];
+ _progressCircle.center = CGPointMake(self.view.bounds.size.width/2, 120);
return _progressCircle;
}
View
14 demo/Classes/ImageCenterViewController.m
@@ -66,7 +66,7 @@ - (void) newImageRetrieved:(NSNotification*)sender{
NSDictionary *dict = [sender userInfo];
- NSInteger tag = [[dict objectForKey:@"tag"] intValue];
+ NSInteger tag = [dict[@"tag"] intValue];
NSArray *paths = [self.tableView indexPathsForVisibleRows];
@@ -78,10 +78,8 @@ - (void) newImageRetrieved:(NSNotification*)sender{
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path];
if(cell.imageView.image == nil && tag == index){
-
- cell.imageView.image = [dict objectForKey:@"image"];
+ cell.imageView.image = dict[@"image"];
[cell setNeedsLayout];
-
}
@@ -91,13 +89,13 @@ - (void) newImageRetrieved:(NSNotification*)sender{
}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
[super loadView];
self.tableView.rowHeight = 120;
self.tableView.allowsSelection = NO;
- UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0,0,320,100)];
+ UIView *v = [[UIView alloc] initWithFrame:CGRectMakeWithPoint(CGPointZero,320,100)];
UILabel *lab = [[UILabel alloc] initWithFrame:CGRectInset(v.bounds, 20, 20)];
lab.text = @"The image cache handles large amounts of network image requests. Good for things like twitter avatars.";
@@ -112,7 +110,7 @@ - (void) loadView{
}
-#pragma mark - TableView Delegate & DataSource
+#pragma mark TableView Delegate & DataSource
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
@@ -132,7 +130,7 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(
int i = indexPath.row;
int index = i % [self.urlArray count];
- NSURL *url = [NSURL URLWithString:[self.urlArray objectAtIndex:index]];
+ NSURL *url = [NSURL URLWithString:self.urlArray[index]];
UIImage *img = [self.imageCache imageForKey:[NSString stringWithFormat:@"%d",index] url:url queueIfNeeded:YES tag:index];
View
6 demo/Classes/LabelViewController.m
@@ -38,7 +38,7 @@ - (id) init{
return self;
}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
[super loadView];
self.navigationItem.rightBarButtonItem = self.editButtonItem;
@@ -64,15 +64,15 @@ - (void) loadView{
}
-#pragma mark - UITableView Delegate & DataSource
+#pragma mark UITableView Delegate & DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.cells count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- return [self.cells objectAtIndex:indexPath.row];
+ return self.cells[indexPath.row];
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return indexPath.row == 1 ? 120 : 44;
View
11 demo/Classes/MoreCellsViewController.h
@@ -32,11 +32,12 @@
#import <UIKit/UIKit.h>
#import <TapkuLibrary/TapkuLibrary.h>
+#pragma mark - MoreCellsViewController
+@interface MoreCellsViewController : UITableViewController
+
+@property (nonatomic,strong) TKButtonCell *buttonCell;
+@property (nonatomic,strong) TKSwitchCell *switchCell;
+@property (nonatomic,strong) TKTextViewCell *textViewCell;
-@interface MoreCellsViewController : UITableViewController {
- TKButtonCell *buttonCell;
- TKSwitchCell *switchCell;
- TKTextViewCell *textViewCell;
-}
@end
View
22 demo/Classes/MoreCellsViewController.m
@@ -39,22 +39,22 @@ - (id) init{
}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) loadView{
[super loadView];
- buttonCell = [[TKButtonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"button"];
- buttonCell.textLabel.text = @"This is a BUTTON Cell";
+ self.buttonCell = [[TKButtonCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"button"];
+ self.buttonCell.textLabel.text = @"This is a BUTTON Cell";
- switchCell = [[TKSwitchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
- switchCell.textLabel.text = @"Switch Cell";
+ self.switchCell = [[TKSwitchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
+ self.switchCell.textLabel.text = @"Switch Cell";
- textViewCell = [[TKTextViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
- 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.";
+ self.textViewCell = [[TKTextViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
+ 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.";
}
-#pragma mark - UITableView Delegate & DataSource
+#pragma mark UITableView Delegate & DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 3;
}
@@ -67,13 +67,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
switch (indexPath.section) {
case 0:
- cell = buttonCell;
+ cell = self.buttonCell;
break;
case 1:
- cell = switchCell;
+ cell = self.switchCell;
break;
default:
- cell = textViewCell;
+ cell = self.textViewCell;
break;
}
View
3 demo/Classes/NetworkRequestViewController.h → ...es/NetworkRequestProgressViewController.h
@@ -32,9 +32,8 @@
#import <UIKit/UIKit.h>
#import <TapkuLibrary/TapkuLibrary.h>
-@interface NetworkRequestViewController : TKViewController <TKHTTPRequestProgressDelegate>
+@interface NetworkRequestProgressViewController : TKViewController <TKHTTPRequestProgressDelegate>
-@property (nonatomic,strong) UITextView *textView;
@property (nonatomic,strong) TKProgressCircleView *circle;
@end
View
55 demo/Classes/NetworkRequestViewController.m → ...es/NetworkRequestProgressViewController.m
@@ -29,9 +29,9 @@
*/
-#import "NetworkRequestViewController.h"
+#import "NetworkRequestProgressViewController.h"
-@implementation NetworkRequestViewController
+@implementation NetworkRequestProgressViewController
- (id) init{
if(!(self=[super init])) return nil;
@@ -40,21 +40,15 @@ - (id) init{
- (void) loadView{
[super loadView];
- self.view.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1];
+ self.view.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1];
+
- CGRect r = CGRectInset(self.view.bounds, 10, 10);
- r.size.height -= 80;
- self.textView = [[UITextView alloc] initWithFrame:r];
- self.textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
- self.textView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
- self.textView.editable = NO;
- [self.view addSubview:self.textView];
- CGFloat y = r.size.height + r.origin.y;
- CGFloat h = self.view.bounds.size.height - y;
+ CGFloat y = self.view.bounds.size.height/2.0;
+ CGFloat x = self.view.bounds.size.width/2.0;
self.circle = [[TKProgressCircleView alloc] init];
- self.circle.center = CGPointMake(self.view.bounds.size.width/2, y + h / 2 );
+ self.circle.center = CGPointMake(x,y);
self.circle.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
[self.circle roundOffFrame];
[self.view addSubview:self.circle];
@@ -73,7 +67,7 @@ - (void) loadView{
- (void) start{
- __weak TKHTTPRequest *req = [TKHTTPRequest requestWithURL:[NSURL URLWithString:@"http://api.dribbble.com/shots/everyone?per_page=30"]];
+ __weak TKHTTPRequest *req = [TKHTTPRequest requestWithURL:[NSURL URLWithString:@"http://devinsheaven.com/tapkulibrary.zip"]];
req.delegate = self;
req.didFinishSelector = @selector(networkRequestDidFinish:);
req.progressDelegate = self;
@@ -85,35 +79,18 @@ - (void) start{
}
- (void) request:(TKHTTPRequest*)request didReceiveTotalBytes:(NSInteger)received ofExpectedBytes:(NSInteger)total{
- [self.circle setProgress:received/total animated:YES];
+
+ CGFloat percentage = (CGFloat)received / (CGFloat)total;
+ NSLog(@"Received... %d of %d (%d%%)",received,total,(NSInteger)(percentage*100));
+ [self.circle setProgress:percentage animated:YES];
}
- (void) networkRequestDidFinish:(TKHTTPRequest*)request{
-
- NSLog(@"Finished... %@",request);
NSData *data = [request responseData];
-
- if(data)
- [self processJSONDataInBackground:data
- withCallbackSelector:@selector(processedData:)
- backgroundSelector:@selector(putJsonIntoObjects:)
- errorSelector:@selector(parseError:)
- readingOptions:0];
-
-
-
-}
-- (void) parseError:(NSError*)error{
- NSLog(@"ERROR: %@",error);
-}
-- (void) processedData:(NSDictionary*)dict{
-
- if(self.textView.text==nil || self.textView.text.length < 1)
- [self.textView setText:[dict description]];
-
-}
-- (id) putJsonIntoObjects:(NSDictionary*)dictionary{
- return dictionary; // we'll just pass back the json dictionary for now
+ NSLog(@"Finished... %@ (length %d)",request,data.length);
+
}
+
+
@end
View
4 demo/Classes/RootViewController.h
@@ -33,11 +33,9 @@
#import <TapkuLibrary/TapkuLibrary.h>
@class DetailViewController;
-
@interface RootViewController : TKTableViewController
@property (nonatomic,strong) NSArray *data;
@property (nonatomic,strong) DetailViewController *detailViewController;
-
-@end
+@end
View
69 demo/Classes/RootViewController.m
@@ -41,7 +41,26 @@
#import "MoreCellsViewController.h"
#import "AlertsViewController.h"
#import "ImageCenterViewController.h"
-#import "NetworkRequestViewController.h"
+#import "NetworkRequestProgressViewController.h"
+#import "CalendarDayViewController.h"
+
+
+@interface UINavigationController (Rotation_IOS6)
+@end
+
+@implementation UINavigationController (Rotation_IOS6)
+
+- (BOOL) shouldAutorotate{
+ return [[self.viewControllers lastObject] shouldAutorotate];
+}
+- (NSUInteger) supportedInterfaceOrientations{
+ return [[self.viewControllers lastObject] supportedInterfaceOrientations];
+}
+- (UIInterfaceOrientation) preferredInterfaceOrientationForPresentation{
+ return [[self.viewControllers lastObject] preferredInterfaceOrientationForPresentation];
+}
+
+@end
@implementation RootViewController
@@ -50,37 +69,32 @@ - (id) initWithStyle:(UITableViewStyle)s{
self.title = @"Tapku Library";
return self;
}
+- (NSUInteger) supportedInterfaceOrientations{
+ return [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ? UIInterfaceOrientationMaskAll : UIInterfaceOrientationMaskPortrait;
+}
+- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
+ return [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad ? YES : UIInterfaceOrientationIsPortrait(interfaceOrientation) ;
+}
-#pragma mark - View Lifecycle
+#pragma mark View Lifecycle
- (void) viewDidLoad{
[super viewDidLoad];
- NSArray *rows;
- NSMutableArray *tmp = [NSMutableArray array];
-
- rows = @[@"Coverflow",@"Month Grid Calendar"];
- [tmp addObject:@{@"rows" : rows, @"title" : @"Views"}];
-
- rows = @[@"Empty Sign",@"Loading HUD",@"Alerts"];
- [tmp addObject:@{@"rows" : rows, @"title" : @"UI Elements"}];
-
- rows = @[@"Label Cells",@"More Cells"];
- [tmp addObject:@{@"rows" : rows, @"title" : @"Table View Cells"}];
-
- rows = @[@"Image Cache",@"HTTP Request"];
- [tmp addObject:@{@"rows" : rows, @"title" : @"Network"}];
-
- self.data = tmp;
+ self.data = @[
+ @{@"rows" : @[@"Coverflow",@"Month Grid Calendar",@"Day Calendar"], @"title" : @"Views"},
+ @{@"rows" : @[@"Empty Sign",@"Loading HUD",@"Alerts"], @"title" : @"UI Elements"},
+ @{@"rows" : @[@"Label Cells",@"More Cells"], @"title" : @"Table View Cells"},
+ @{@"rows" : @[@"Image Cache",@"HTTP Request Progress"], @"title" : @"Network"}];
}
-#pragma mark - UITableView Delegate & DataSource
+#pragma mark UITableView Delegate & DataSource
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
return [self.data count];
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
- return [[[self.data objectAtIndex:section] objectForKey:@"rows"] count];
+ return [self.data[section][@"rows"] count];
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -90,7 +104,7 @@ - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
- cell.textLabel.text = [[[self.data objectAtIndex:indexPath.section] objectForKey:@"rows"] objectAtIndex:indexPath.row];
+ cell.textLabel.text = self.data[indexPath.section][@"rows"][indexPath.row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
@@ -101,7 +115,7 @@ - (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)inde
UIViewController *vc;
int s = indexPath.section, r = indexPath.row;
- if(s==0 && r < 1){
+ if(s==0 && r == 0){
vc = [[CoverflowViewController alloc] init];
if(self.detailViewController)
@@ -115,6 +129,9 @@ - (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)inde
}else if(s==0 && r==1)
vc = [[CalendarMonthViewController alloc] initWithSunday:YES];
+ else if(s==0 && r==2)
+ vc = [[CalendarDayViewController alloc] init];
+
else if(s==1 && r==0)
vc = [[EmptyViewController alloc] init];
else if(s==1 && r==1)
@@ -130,20 +147,20 @@ - (void) tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)inde
else if(s==3 && r==0)
vc = [[ImageCenterViewController alloc] init];
else
- vc = [[NetworkRequestViewController alloc] init];
+ vc = [[NetworkRequestProgressViewController alloc] init];
- if(self.detailViewController && !(s==0 && r==1))
+ if(self.detailViewController && !(s==0))
[self.detailViewController setupWithMainController:vc];
else
[self.navigationController pushViewController:vc animated:YES];
}
- (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
- return [[self.data objectAtIndex:section] objectForKey:@"title"];
+ return self.data[section][@"title"];
}
- (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
- return [[self.data objectAtIndex:section] objectForKey:@"footer"];
+ return self.data[section][@"footer"];
}
@end
View
10 demo/Demo-Info.plist
@@ -32,6 +32,16 @@
<string>launch_iphone.png</string>
<key>UIPrerenderedIcon</key>
<true/>
+ <key>UIStatusBarTintParameters</key>
+ <dict>
+ <key>UINavigationBar</key>
+ <dict>
+ <key>Style</key>
+ <string>UIBarStyleDefault</string>
+ <key>Translucent</key>
+ <false/>
+ </dict>
+ </dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
View
30 demo/Demo.xcodeproj/project.pbxproj
@@ -9,6 +9,8 @@
/* Begin PBXBuildFile section */
1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 200908B616F627F60012DC4F /* launch_iphone@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 200908B516F627F60012DC4F /* launch_iphone@2x.png */; };
+ 200908BB16F6561D0012DC4F /* TapkuLibrary.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 200908BA16F6561D0012DC4F /* TapkuLibrary.bundle */; };
2052AF6C168B83C600A49526 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF6B168B83C600A49526 /* main.m */; };
2052AF88168B83E900A49526 /* AlertsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF6F168B83E900A49526 /* AlertsViewController.m */; };
2052AF89168B83E900A49526 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF71168B83E900A49526 /* AppDelegate.m */; };
@@ -20,7 +22,7 @@
2052AF8F168B83E900A49526 /* ImageCenterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF7D168B83E900A49526 /* ImageCenterViewController.m */; };
2052AF90168B83E900A49526 /* LabelViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF7F168B83E900A49526 /* LabelViewController.m */; };
2052AF92168B83E900A49526 /* MoreCellsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF83168B83E900A49526 /* MoreCellsViewController.m */; };
- 2052AF93168B83E900A49526 /* NetworkRequestViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF85168B83E900A49526 /* NetworkRequestViewController.m */; };
+ 2052AF93168B83E900A49526 /* NetworkRequestProgressViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF85168B83E900A49526 /* NetworkRequestProgressViewController.m */; };
2052AF94168B83E900A49526 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2052AF87168B83E900A49526 /* RootViewController.m */; };
2052AFB4168B840B00A49526 /* Back.png in Resources */ = {isa = PBXBuildFile; fileRef = 2052AF97168B840B00A49526 /* Back.png */; };
2052AFB5168B840B00A49526 /* Back@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2052AF98168B840B00A49526 /* Back@2x.png */; };
@@ -49,8 +51,8 @@
2052AFCC168B840B00A49526 /* icon_74.png in Resources */ = {isa = PBXBuildFile; fileRef = 2052AFB1168B840B00A49526 /* icon_74.png */; };
2052AFCD168B840B00A49526 /* launch_iphone-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 2052AFB2168B840B00A49526 /* launch_iphone-568h@2x.png */; };
2052AFCE168B840B00A49526 /* launch_iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 2052AFB3168B840B00A49526 /* launch_iphone.png */; };
+ 20CAEA9216F4EE6400D347E1 /* CalendarDayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 20CAEA9116F4EE6400D347E1 /* CalendarDayViewController.m */; };
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
- 3B07B33C133AAE06001B1C6F /* TapkuLibrary.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3B07B33B133AAE06001B1C6F /* TapkuLibrary.bundle */; };
3B111E5414593FA200C72A38 /* libTapkuLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B111E4F14593F8800C72A38 /* libTapkuLibrary.a */; };
3BF88C1B11E547BE00C9FC43 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BF88BEB11E547A000C9FC43 /* QuartzCore.framework */; };
/* End PBXBuildFile section */
@@ -83,6 +85,8 @@
1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1D6058910D05DD3D006BFB54 /* unviersaldemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = unviersaldemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 200908B516F627F60012DC4F /* launch_iphone@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "launch_iphone@2x.png"; sourceTree = "<group>"; };
+ 200908BA16F6561D0012DC4F /* TapkuLibrary.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = TapkuLibrary.bundle; path = ../../../src/TapkuLibrary.bundle; sourceTree = "<group>"; };
2052AF6B168B83C600A49526 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2052AF6E168B83E900A49526 /* AlertsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlertsViewController.h; sourceTree = "<group>"; };
2052AF6F168B83E900A49526 /* AlertsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlertsViewController.m; sourceTree = "<group>"; };
@@ -104,8 +108,8 @@
2052AF7F168B83E900A49526 /* LabelViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LabelViewController.m; sourceTree = "<group>"; };
2052AF82168B83E900A49526 /* MoreCellsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MoreCellsViewController.h; sourceTree = "<group>"; };
2052AF83168B83E900A49526 /* MoreCellsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MoreCellsViewController.m; sourceTree = "<group>"; };
- 2052AF84168B83E900A49526 /* NetworkRequestViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkRequestViewController.h; sourceTree = "<group>"; };
- 2052AF85168B83E900A49526 /* NetworkRequestViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkRequestViewController.m; sourceTree = "<group>"; };
+ 2052AF84168B83E900A49526 /* NetworkRequestProgressViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkRequestProgressViewController.h; sourceTree = "<group>"; };
+ 2052AF85168B83E900A49526 /* NetworkRequestProgressViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkRequestProgressViewController.m; sourceTree = "<group>"; };
2052AF86168B83E900A49526 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
2052AF87168B83E900A49526 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = "<group>"; };
2052AF97168B840B00A49526 /* Back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Back.png; sourceTree = "<group>"; };
@@ -135,9 +139,10 @@
2052AFB1168B840B00A49526 /* icon_74.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_74.png; sourceTree = "<group>"; };
2052AFB2168B840B00A49526 /* launch_iphone-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "launch_iphone-568h@2x.png"; sourceTree = "<group>"; };
2052AFB3168B840B00A49526 /* launch_iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = launch_iphone.png; sourceTree = "<group>"; };
+ 20CAEA9016F4EE6400D347E1 /* CalendarDayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CalendarDayViewController.h; sourceTree = "<group>"; };
+ 20CAEA9116F4EE6400D347E1 /* CalendarDayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CalendarDayViewController.m; sourceTree = "<group>"; };
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
32CA4F630368D1EE00C91783 /* Demo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Demo_Prefix.pch; sourceTree = "<group>"; };
- 3B07B33B133AAE06001B1C6F /* TapkuLibrary.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = TapkuLibrary.bundle; path = ../src/TapkuLibrary.bundle; sourceTree = SOURCE_ROOT; };
3B111E4614593F8800C72A38 /* TapkuLibrary.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = TapkuLibrary.xcodeproj; path = ../src/TapkuLibrary.xcodeproj; sourceTree = "<group>"; };
3BF88BEB11E547A000C9FC43 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
8D1107310486CEB800E47090 /* Demo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Demo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
@@ -187,7 +192,6 @@
2052AF95168B840B00A49526 /* Assets */ = {
isa = PBXGroup;
children = (
- 3B07B33B133AAE06001B1C6F /* TapkuLibrary.bundle */,
2052AF96168B840B00A49526 /* Images */,
);
path = Assets;
@@ -196,6 +200,7 @@
2052AF96168B840B00A49526 /* Images */ = {
isa = PBXGroup;
children = (
+ 200908BA16F6561D0012DC4F /* TapkuLibrary.bundle */,
2052AF97168B840B00A49526 /* Back.png */,
2052AF98168B840B00A49526 /* Back@2x.png */,
2052AF99168B840B00A49526 /* beer.png */,
@@ -207,6 +212,7 @@
2052AFB1168B840B00A49526 /* icon_74.png */,
2052AFB2168B840B00A49526 /* launch_iphone-568h@2x.png */,
2052AFB3168B840B00A49526 /* launch_iphone.png */,
+ 200908B516F627F60012DC4F /* launch_iphone@2x.png */,
);
path = Images;
sourceTree = "<group>";
@@ -248,8 +254,8 @@
children = (
2052AF7C168B83E900A49526 /* ImageCenterViewController.h */,
2052AF7D168B83E900A49526 /* ImageCenterViewController.m */,
- 2052AF84168B83E900A49526 /* NetworkRequestViewController.h */,
- 2052AF85168B83E900A49526 /* NetworkRequestViewController.m */,
+ 2052AF84168B83E900A49526 /* NetworkRequestProgressViewController.h */,
+ 2052AF85168B83E900A49526 /* NetworkRequestProgressViewController.m */,
);
name = Network;
sourceTree = "<group>";
@@ -285,6 +291,8 @@
2052AF73168B83E900A49526 /* CoverflowViewController.m */,
2052AF74168B83E900A49526 /* CalendarMonthViewController.h */,
2052AF75168B83E900A49526 /* CalendarMonthViewController.m */,
+ 20CAEA9016F4EE6400D347E1 /* CalendarDayViewController.h */,
+ 20CAEA9116F4EE6400D347E1 /* CalendarDayViewController.m */,
);
name = Views;
sourceTree = "<group>";
@@ -408,7 +416,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 3B07B33C133AAE06001B1C6F /* TapkuLibrary.bundle in Resources */,
2052AFB4168B840B00A49526 /* Back.png in Resources */,
2052AFB5168B840B00A49526 /* Back@2x.png in Resources */,
2052AFB6168B840B00A49526 /* beer.png in Resources */,
@@ -436,6 +443,8 @@
2052AFCC168B840B00A49526 /* icon_74.png in Resources */,
2052AFCD168B840B00A49526 /* launch_iphone-568h@2x.png in Resources */,
2052AFCE168B840B00A49526 /* launch_iphone.png in Resources */,
+ 200908B616F627F60012DC4F /* launch_iphone@2x.png in Resources */,
+ 200908BB16F6561D0012DC4F /* TapkuLibrary.bundle in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -457,8 +466,9 @@
2052AF8F168B83E900A49526 /* ImageCenterViewController.m in Sources */,
2052AF90168B83E900A49526 /* LabelViewController.m in Sources */,
2052AF92168B83E900A49526 /* MoreCellsViewController.m in Sources */,
- 2052AF93168B83E900A49526 /* NetworkRequestViewController.m in Sources */,
+ 2052AF93168B83E900A49526 /* NetworkRequestProgressViewController.m in Sources */,
2052AF94168B83E900A49526 /* RootViewController.m in Sources */,
+ 20CAEA9216F4EE6400D347E1 /* CalendarDayViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
View
1 demo/Demo_Prefix.pch
@@ -5,4 +5,5 @@
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
+ #import <TapkuLibrary/TapkuLibrary.h>
#endif
View
4 src/DataTests.m
@@ -68,8 +68,8 @@ - (void) testDataImporting{
SampleItem *item = [SampleItem createObject:dict];
- STAssertEqualObjects([dict objectForKey:@"name"], item.name, @"%@ isn't equal to %@",[dict objectForKey:@"name"],item.name);
- STAssertEqualObjects([dict objectForKey:@"id"], item.identifier, @"%@ isn't equal to %@",[dict objectForKey:@"id"],item.identifier);
+ STAssertEqualObjects(dict[@"name"], item.name, @"%@ isn't equal to %@",dict[@"name"],item.name);
+ STAssertEqualObjects(dict[@"id"], item.identifier, @"%@ isn't equal to %@",dict[@"id"],item.identifier);
STAssertNotNil(item.createdAt, @"SampleItem createdAt should not be nil");
STAssertNotNil(item.updatedAt, @"SampleItem updatedAt should not be nil");
View
BIN src/TapkuLibrary.bundle/Images/calendar/nob.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/TapkuLibrary.bundle/Images/calendar/nob@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/TapkuLibrary.bundle/Images/calendar/timeline.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN src/TapkuLibrary.bundle/Images/calendar/timeline@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
26 src/TapkuLibrary.xcodeproj/project.pbxproj
@@ -49,12 +49,10 @@
3B6EDDEB11547C2800E454DA /* TKCalendarMonthViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC99FE10953E2400F235F1 /* TKCalendarMonthViewController.h */; };
3B6EDDEE11547C2900E454DA /* TKCalendarMonthTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B879FC5109BFC07002012FD /* TKCalendarMonthTableViewController.m */; };
3B6EDDEF11547C2900E454DA /* TKCalendarMonthTableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B879FC4109BFC07002012FD /* TKCalendarMonthTableViewController.h */; };
- 3B6EDDF011547C2A00E454DA /* TapDetectingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0810953E2400F235F1 /* TapDetectingView.m */; };
- 3B6EDDF111547C2B00E454DA /* TapDetectingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0710953E2400F235F1 /* TapDetectingView.h */; };
3B6EDDF211547C2C00E454DA /* TKCalendarDayViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0610953E2400F235F1 /* TKCalendarDayViewController.m */; };
3B6EDDF311547C2C00E454DA /* TKCalendarDayViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0510953E2400F235F1 /* TKCalendarDayViewController.h */; };
- 3B6EDDF411547C2D00E454DA /* TKCalendarDayTimelineView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0410953E2400F235F1 /* TKCalendarDayTimelineView.m */; };
- 3B6EDDF511547C3000E454DA /* TKCalendarDayTimelineView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0310953E2400F235F1 /* TKCalendarDayTimelineView.h */; };
+ 3B6EDDF411547C2D00E454DA /* TKCalendarDayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0410953E2400F235F1 /* TKCalendarDayView.m */; };
+ 3B6EDDF511547C3000E454DA /* TKCalendarDayView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0310953E2400F235F1 /* TKCalendarDayView.h */; };
3B6EDDF611547C3000E454DA /* TKCalendarDayEventView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A0210953E2400F235F1 /* TKCalendarDayEventView.m */; };
3B6EDDF711547C3100E454DA /* TKCalendarDayEventView.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BAC9A0110953E2400F235F1 /* TKCalendarDayEventView.h */; };
3B6EDDFC11547C3800E454DA /* TKEmptyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BAC9A4F10953E5200F235F1 /* TKEmptyView.m */; };
@@ -167,12 +165,10 @@
3BAC99FF10953E2400F235F1 /* TKCalendarMonthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarMonthViewController.m; sourceTree = "<group>"; };
3BAC9A0110953E2400F235F1 /* TKCalendarDayEventView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayEventView.h; sourceTree = "<group>"; };
3BAC9A0210953E2400F235F1 /* TKCalendarDayEventView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayEventView.m; sourceTree = "<group>"; };
- 3BAC9A0310953E2400F235F1 /* TKCalendarDayTimelineView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayTimelineView.h; sourceTree = "<group>"; };
- 3BAC9A0410953E2400F235F1 /* TKCalendarDayTimelineView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayTimelineView.m; sourceTree = "<group>"; };
+ 3BAC9A0310953E2400F235F1 /* TKCalendarDayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayView.h; sourceTree = "<group>"; };
+ 3BAC9A0410953E2400F235F1 /* TKCalendarDayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayView.m; sourceTree = "<group>"; };
3BAC9A0510953E2400F235F1 /* TKCalendarDayViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKCalendarDayViewController.h; sourceTree = "<group>"; };
3BAC9A0610953E2400F235F1 /* TKCalendarDayViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKCalendarDayViewController.m; sourceTree = "<group>"; };
- 3BAC9A0710953E2400F235F1 /* TapDetectingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TapDetectingView.h; sourceTree = "<group>"; };
- 3BAC9A0810953E2400F235F1 /* TapDetectingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TapDetectingView.m; sourceTree = "<group>"; };
3BAC9A1B10953E5200F235F1 /* TapkuLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TapkuLibrary.h; sourceTree = "<group>"; };
3BAC9A1D10953E5200F235F1 /* TKGlobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TKGlobal.h; sourceTree = "<group>"; };
3BAC9A1E10953E5200F235F1 /* TKGlobal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TKGlobal.m; sourceTree = "<group>"; };
@@ -358,12 +354,10 @@
children = (
3BAC9A0510953E2400F235F1 /* TKCalendarDayViewController.h */,
3BAC9A0610953E2400F235F1 /* TKCalendarDayViewController.m */,
+ 3BAC9A0310953E2400F235F1 /* TKCalendarDayView.h */,
+ 3BAC9A0410953E2400F235F1 /* TKCalendarDayView.m */,
3BAC9A0110953E2400F235F1 /* TKCalendarDayEventView.h */,
3BAC9A0210953E2400F235F1 /* TKCalendarDayEventView.m */,
- 3BAC9A0310953E2400F235F1 /* TKCalendarDayTimelineView.h */,
- 3BAC9A0410953E2400F235F1 /* TKCalendarDayTimelineView.m */,
- 3BAC9A0710953E2400F235F1 /* TapDetectingView.h */,
- 3BAC9A0810953E2400F235F1 /* TapDetectingView.m */,
);
name = Day;
sourceTree = "<group>";
@@ -520,9 +514,8 @@
3B6EDDE511547C1E00E454DA /* NSDate+TKCategory.h in Headers */,
3B6EDDEB11547C2800E454DA /* TKCalendarMonthViewController.h in Headers */,
3B6EDDEF11547C2900E454DA /* TKCalendarMonthTableViewController.h in Headers */,
- 3B6EDDF111547C2B00E454DA /* TapDetectingView.h in Headers */,
3B6EDDF311547C2C00E454DA /* TKCalendarDayViewController.h in Headers */,
- 3B6EDDF511547C3000E454DA /* TKCalendarDayTimelineView.h in Headers */,
+ 3B6EDDF511547C3000E454DA /* TKCalendarDayView.h in Headers */,
3B6EDDF711547C3100E454DA /* TKCalendarDayEventView.h in Headers */,
3B6EDDFD11547C3800E454DA /* TKEmptyView.h in Headers */,
3B6EDE0C11547C4700E454DA /* TKTextViewCell.h in Headers */,
@@ -648,7 +641,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n";
+ shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"";
};
/* End PBXShellScriptBuildPhase section */
@@ -682,9 +675,8 @@
3B6EDDE411547C1D00E454DA /* NSDate+TKCategory.m in Sources */,
3B6EDDEA11547C2700E454DA /* TKCalendarMonthViewController.m in Sources */,
3B6EDDEE11547C2900E454DA /* TKCalendarMonthTableViewController.m in Sources */,
- 3B6EDDF011547C2A00E454DA /* TapDetectingView.m in Sources */,
3B6EDDF211547C2C00E454DA /* TKCalendarDayViewController.m in Sources */,
- 3B6EDDF411547C2D00E454DA /* TKCalendarDayTimelineView.m in Sources */,
+ 3B6EDDF411547C2D00E454DA /* TKCalendarDayView.m in Sources */,
3B6EDDF611547C3000E454DA /* TKCalendarDayEventView.m in Sources */,
3B6EDDFC11547C3800E454DA /* TKEmptyView.m in Sources */,
3B6EDE0B11547C4600E454DA /* TKTextViewCell.m in Sources */,
View
12 src/TapkuLibrary/NSDate+CalendarGrid.h
@@ -10,12 +10,12 @@
@interface NSDate (CalendarGrid)
-- (NSDate*) firstOfMonth;
-- (NSDate*) nextMonth;
-- (NSDate*) previousMonth;
+- (NSDate*) firstOfMonthWithTimeZone:(NSTimeZone*)timeZone;
+- (NSDate*) nextMonthWithTimeZone:(NSTimeZone*)timeZone;
+- (NSDate*) previousMonthWithTimeZone:(NSTimeZone*)timeZone;
-- (NSDate*) lastOfMonthDate;
-+ (NSDate*) lastofMonthDate;
-+ (NSDate*) lastOfCurrentMonth;
+- (NSDate*) lastOfMonthDateWithTimeZone:(NSTimeZone*)timeZone;
++ (NSDate*) lastofMonthDateWithTimeZone:(NSTimeZone*)timeZone;
++ (NSDate*) lastOfCurrentMonthWithTimeZone:(NSTimeZone*)timeZone;
@end
View
52 src/TapkuLibrary/NSDate+CalendarGrid.m
@@ -12,65 +12,71 @@
@implementation NSDate (CalendarGrid)
-- (NSDate*) firstOfMonth{
- TKDateInformation info = [self dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+- (NSDate*) firstOfMonthWithTimeZone:(NSTimeZone*)timeZone{
+
+ NSDateComponents *info = [self dateComponentsWithTimeZone:timeZone];
+
info.day = 1;
info.minute = 0;
info.second = 0;
info.hour = 0;
- return [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+
+ info.timeZone = timeZone;
+
+ return [NSDate dateWithDateComponents:info];
}
-- (NSDate*) nextMonth{
+- (NSDate*) nextMonthWithTimeZone:(NSTimeZone*)timeZone{
- TKDateInformation info = [self dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ NSDateComponents *info = [self dateComponentsWithTimeZone:timeZone];
info.month++;
if(info.month>12){
info.month = 1;
info.year++;
}
- info.minute = 0;
- info.second = 0;
- info.hour = 0;
+ info.minute = info.second = info.hour = 0;
- return [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ return [NSDate dateWithDateComponents:info];
}
-- (NSDate*) previousMonth{
-
+- (NSDate*) previousMonthWithTimeZone:(NSTimeZone*)timeZone{
- TKDateInformation info = [self dateInformationWithTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
- info.month--;
- if(info.month<1){
- info.month = 12;
- info.year--;
+ NSDateComponents *components = [self dateComponentsWithTimeZone:timeZone];
+
+ components.month--;
+ if(components.month<1){
+ components.month = 12;
+ components.year--;
}
- info.minute = 0;
- info.second = 0;
- info.hour = 0;
- return [NSDate dateFromDateInformation:info timeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
+ components.second = components.minute = components.hour = 0;
+
+
+ return [NSDate dateWithDateComponents:components];
+
}
-- (NSDate*) lastOfMonthDate {
+- (NSDate*) lastOfMonthDateWithTimeZone:(NSTimeZone*)timeZone{
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
+ gregorian.timeZone = timeZone;
NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:self];
+ comp.timeZone = timeZone;
[comp setDay:0];
[comp setMonth:comp.month+1];
NSDate *date = [gregorian dateFromComponents:comp];
return date;
}
-+ (NSDate*) lastofMonthDate{
++ (NSDate*) lastofMonthDateWithTimeZone:(NSTimeZone*)timeZone{
NSDate *day = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:day];
[comp setDay:0];
[comp setMonth:comp.month+1];
return [gregorian dateFromComponents:comp];
}
-+ (NSDate*) lastOfCurrentMonth{
++ (NSDate*) lastOfCurrentMonthWithTimeZone:(NSTimeZone*)timeZone{
NSDate *day = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:day];
View
134 src/TapkuLibrary/NSDate+TKCategory.h
@@ -33,62 +33,146 @@
#import <Foundation/Foundation.h>
-
-struct TKDateInformation {
- int day;
- int month;
- int year;
-
- int weekday;
-
- int minute;
- int hour;
- int second;
-
-};
-typedef struct TKDateInformation TKDateInformation;
-
+#pragma mark - NSDate + TKCategory
/** Additional functionality for `NSDate`. */
@interface NSDate (TKCategory)
+
+#pragma mark Yesterday
+/** Creates and returns a new date set to the previous day and current time.
+ @return A `NSDate` object set to the current month.
+ */
+ (NSDate *) yesterday;
+/** Creates and returns a new date set to the previous day and current time.
+ @param timeZone The time zone to repect.
+ @note Things get tricky with respect to day light saving. Simple subtraction of 24 hours (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
+ @return A `NSDate` object set to the current month.
+ */
++ (NSDate*) yesterdayWithTimeZone:(NSTimeZone*)timeZone;
+
-/** Creates and returns a new date set to the current month.
+#pragma mark Month
+/** Creates and returns a new date set to the current month date.
@return A `NSDate` object set to the current month.
*/
+ (NSDate *) month;
+/** Creates and returns a new date set to the current month date.
+ @param timeZone The time zone to repect.
+ @note Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
+ @return A `NSDate` object set to the current month.
+ */
++ (NSDate*) monthWithTimeZone:(NSTimeZone*)timeZone;
+
/** Creates and returns a new date set to the first day of the month from the date object.
@return A `NSDate` object set to the same month as the date object. The day will be the first of the month.
*/
-- (NSDate *) monthDate;
+- (NSDate*) monthDate;
+/** Creates and returns a new date set to the first day of the month from the date object.
+ @param timeZone Time Zone for month.
+ @note Things get tricky with respect to day light saving. Simple subtraction of a give time (using @code[NSDate dateWithTimeIntervalSinceNow:]@endcode) might not yield the expected results.
+ @return A `NSDate` object set to the same month as the date object. The day will be the first of the month.
+ */
+- (NSDate *) monthDateWithTimeZone:(NSTimeZone*)timeZone;
+#pragma mark Same Day
+/** Returns whether the compared date shares the date with respect to the default time zone.
+ @return YES if the two dates share the same year, month day. Otherwise NO.
+ */
- (BOOL) isSameDay:(NSDate*)anotherDate;
-- (int) monthsBetweenDate:(NSDate *)toDate;
+
+/** Returns whether the compared date shares the date with respect to the given time zone.
+ @param timeZone The time zone used to determine the current day.
+ @return YES if the two dates share the same year, month day. Otherwise NO.
+ */
+- (BOOL) isSameDay:(NSDate*)anotherDate timeZone:(NSTimeZone*)timeZone;
+
+#pragma mark Month and Days Between
+
+/** Returns number of months between two dates.
+ @param date The other date to compare.
+ @return Returns number of months between two dates.
+ */
+- (NSInteger) monthsBetweenDate:(NSDate *)date;
+
+
+
+/** Returns number of months between two dates.
+ @param date The other date to compare.
+ @param timeZone The time zone to respect.
+ @return Returns number of months between two dates.
+ */
+- (NSInteger) monthsBetweenDate:(NSDate *)toDate timeZone:(NSTimeZone*)timeZone;
+
- (NSInteger) daysBetweenDate:(NSDate*)date;
+
+#pragma mark Is Today
/** Returns a Boolean value that indicates whether the date object is that same date information as the current day.
@return YES if the date object represents the current date, otherwise NO.
*/
- (BOOL) isToday;
+/** Returns a Boolean value that indicates whether the date object is that same date information as the current day.
+ @param timeZone The time zone to respect.
+ @return YES if the date object represents the current date, otherwise NO.
+ */
+- (BOOL) isTodayWithTimeZone:(NSTimeZone*)timeZone;
-- (NSDate *) dateByAddingDays:(NSUInteger)days;
-+ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime;
+#pragma mark Month & Year String
+/** Returns a NSString with the localized month and year string for the NSDate object.
+ @return An NSString object.
+ */
- (NSString *) monthYearString;
+
+/** Returns a NSString with the localized month and year string for the NSDate object.
+ @param timeZone The time zone to respect.
+ @return An NSString object.
+ */
+- (NSString *) monthYearStringWithTimeZone:(NSTimeZone*)timeZone;
+
+/** Returns a NSString with the localized month string for the NSDate object.
+ @return An NSString object.
+ */
- (NSString *) monthString;
+
+/** Returns a NSString with the localized month string for the NSDate object.
+ @param timeZone The time zone to respect.
+ @return An NSString object.
+ */
+- (NSString*) monthStringWithTimeZone:(NSTimeZone*)timeZone;
+
+/** Returns a NSString with the localized year string for the NSDate object.
+ @return An NSString object.
+ */
- (NSString *) yearString;
+/** Returns a NSString with the localized year string for the NSDate object.
+ @param timeZone The time zone to respect.
+ @return An NSString object.
+ */
+- (NSString*) yearStringWithTimeZone:(NSTimeZone*)timeZone;
+
-- (TKDateInformation) dateInformation;
-- (TKDateInformation) dateInformationWithTimeZone:(NSTimeZone*)tz;
-+ (NSDate*) dateFromDateInformation:(TKDateInformation)info;
-+ (NSDate*) dateFromDateInformation:(TKDateInformation)info timeZone:(NSTimeZone*)tz;
-+ (NSString*) dateInformationDescriptionWithInformation:(TKDateInformation)info;
+#pragma mark Date Compontents
+/** Returns a NSDate from the given component information for the gregorian calendar.
+ @param components The information used to create the date.
+ @return A NSDate object.
+ */
++ (NSDate*) dateWithDateComponents:(NSDateComponents*)components;
+/** Returns an NSDateComponents object from the NSDate object with respect to the given time zone and gregorian calendar.
+ @param timeZone The time zone to respect.
+ @return A NSDateComponents object.
+ */
+- (NSDateComponents*) dateComponentsWithTimeZone:(NSTimeZone*)timeZone;
+
+
+- (NSDate *) dateByAddingDays:(NSUInteger)days;
++ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime;
@end
View
240 src/TapkuLibrary/NSDate+TKCategory.m
@@ -30,196 +30,172 @@
*/
#import "NSDate+TKCategory.h"
-
+#pragma mark - NSDate + TKCategory
@implementation NSDate (TKCategory)
+#pragma mark Yesterday
+ (NSDate*) yesterday{
- TKDateInformation inf = [[NSDate date] dateInformation];
- inf.day--;
- return [NSDate dateFromDateInformation:inf];
+ return [NSDate yesterdayWithTimeZone:[NSTimeZone defaultTimeZone]];
}
-+ (NSDate*) month{
- return [[NSDate date] monthDate];
++ (NSDate*) yesterdayWithTimeZone:(NSTimeZone*)timeZone{
+ NSDateComponents *comp = [[NSDate date] dateComponentsWithTimeZone:timeZone];
+ comp.day--;
+ return [NSDate dateWithDateComponents:comp];
+}
+
+
+#pragma mark Tomorrow
++ (NSDate*) tomorrow{
+ return [NSDate tomorrowWithTimeZone:[NSTimeZone defaultTimeZone]];
+}
++ (NSDate*) tomorrowWithTimeZone:(NSTimeZone*)timeZone{
+ NSDateComponents *comp = [[NSDate date] dateComponentsWithTimeZone:timeZone];
+ comp.day++;
+ return [NSDate dateWithDateComponents:comp];
}
-- (NSDate*) monthDate {
+#pragma mark Month
++ (NSDate*) month{
+ return [[NSDate date] monthDateWithTimeZone:[NSTimeZone defaultTimeZone]];
+}
++ (NSDate*) monthWithTimeZone:(NSTimeZone*)timeZone{
+ return [[NSDate date] monthDateWithTimeZone:timeZone];
+}
+- (NSDate*) monthDate{
+ return [self monthDateWithTimeZone:[NSTimeZone defaultTimeZone]];
+}
+- (NSDate*) monthDateWithTimeZone:(NSTimeZone*)timeZone{
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
+ gregorian.timeZone = timeZone;
NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:self];
[comp setDay:1];
NSDate *date = [gregorian dateFromComponents:comp];
return date;
}
-- (int) weekday{
- NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
- NSDateComponents *comps = [gregorian components:(NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSWeekdayCalendarUnit) fromDate:self];
- int weekday = [comps weekday];
- return weekday;
+#pragma mark Between
+- (NSInteger) monthsBetweenDate:(NSDate *)toDate{
+ return [self monthsBetweenDate:toDate timeZone:[NSTimeZone defaultTimeZone]];
}
-- (NSDate*) timelessDate {
- NSDate *day = self;
- NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
- NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:day];
- return [gregorian dateFromComponents:comp];
+- (NSInteger) monthsBetweenDate:(NSDate *)toDate timeZone:(NSTimeZone*)timeZone{
+ if([self compare:toDate]==NSOrderedSame) return 0;
+
+ NSDate *first = nil, *last = nil;
+ if([self compare:toDate] == NSOrderedAscending){
+ first = self;
+ last = toDate;
+ }else{
+ first = toDate;
+ last = self;
+ }
+
+ NSDateComponents *d1 = [first dateComponentsWithTimeZone:timeZone];
+ NSDateComponents *d2 = [last dateComponentsWithTimeZone:timeZone];
+
+ if(d1.year == d2.year)
+ return d2.month - d1.month;
+
+
+ NSInteger ret = 12 - d1.month;
+ ret += d2.month;
+ d1.year += 1;
+ ret += 12 * (d2.year-d1.year);
+
+ return ret;
}
-- (NSDate*) monthlessDate {
- NSDate *day = self;
- NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
- NSDateComponents *comp = [gregorian components:(NSYearCalendarUnit | NSMonthCalendarUnit) fromDate:day];
- return [gregorian dateFromComponents:comp];
+- (NSInteger) daysBetweenDate:(NSDate*)date {
+ NSTimeInterval time = [self timeIntervalSinceDate:date];
+ return ((abs(time) / (60.0 * 60.0 * 24.0)) + 0.5);
}
-
-
+#pragma mark Same Day
- (BOOL) isSameDay:(NSDate*)anotherDate{
+ return [self isSameDay:anotherDate timeZone:[NSTimeZone defaultTimeZone]];
+}
+- (BOOL) isSameDay:(NSDate*)anotherDate timeZone:(NSTimeZone*)timeZone{
NSCalendar* calendar = [NSCalendar currentCalendar];
+ calendar.timeZone = timeZone;
NSDateComponents* components1 = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:self];
NSDateComponents* components2 = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:anotherDate];
return ([components1 year] == [components2 year] && [components1 month] == [components2 month] && [components1 day] == [components2 day]);
-}
-
-- (int) monthsBetweenDate:(NSDate *)toDate{
- NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
-
- NSDateComponents *components = [gregorian components:NSMonthCalendarUnit
- fromDate:[self monthlessDate]
- toDate:[toDate monthlessDate]
- options:0];
- NSInteger months = [components month];
- return abs(months);
-}
-
-- (NSInteger) daysBetweenDate:(NSDate*)date {
- NSTimeInterval time = [self timeIntervalSinceDate:date];
- return ((abs(time) / (60.0 * 60.0 * 24.0)) + 0.5);
}
+#pragma mark Is Today
- (BOOL) isToday{
return [self isSameDay:[NSDate date]];
-}
-
-
-
-- (NSDate *) dateByAddingDays:(NSUInteger)days {
- NSDateComponents *c = [[NSDateComponents alloc] init];
- c.day = days;
- return [[NSCalendar currentCalendar] dateByAddingComponents:c toDate:self options:0];
}
-+ (NSDate *) dateWithDatePart:(NSDate *)aDate andTimePart:(NSDate *)aTime {
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
- [dateFormatter setDateFormat:@"dd/MM/yyyy"];
- NSString *datePortion = [dateFormatter stringFromDate:aDate];
-
- [dateFormatter setDateFormat:@"HH:mm"];
- NSString *timePortion = [dateFormatter stringFromDate:aTime];
-
- [dateFormatter setDateFormat:@"dd/MM/yyyy HH:mm"];
- NSString *dateTime = [NSString stringWithFormat:@"%@ %@",datePortion,timePortion];
- return [dateFormatter dateFromString:dateTime];
+- (BOOL) isTodayWithTimeZone:(NSTimeZone*)timeZone{
+ return [self isSameDay:[NSDate date] timeZone:timeZone];
}
-- (NSString *) monthYearString {
+#pragma mark Month & Year String
+- (NSString *) monthYearString{
+ return [self monthYearStringWithTimeZone:[NSTimeZone defaultTimeZone]];
+}
+- (NSString *) monthYearStringWithTimeZone:(NSTimeZone*)timeZone{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ dateFormatter.timeZone = timeZone;
dateFormatter.dateFormat = [NSDateFormatter dateFormatFromTemplate:@"yMMMM"
options:0
locale:[NSLocale currentLocale]];
return [dateFormatter stringFromDate:self];
}
- (NSString*) monthString{
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ return [self monthStringWithTimeZone:[NSTimeZone defaultTimeZone]];
+}
+- (NSString*) monthStringWithTimeZone:(NSTimeZone*)timeZone{
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ dateFormatter.timeZone = timeZone;
[dateFormatter setDateFormat:@"MMMM"];
return [dateFormatter stringFromDate:self];
}
+
- (NSString*) yearString{
- NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ return [self yearStringWithTimeZone:[NSTimeZone defaultTimeZone]];
+}
+- (NSString*) yearStringWithTimeZone:(NSTimeZone*)timeZone{
+ NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+ dateFormatter.timeZone = timeZone;
[dateFormatter setDateFormat:@"yyyy"];
return [dateFormatter stringFromDate:self];
}
-
-- (TKDateInformation) dateInformationWithTimeZone:(NSTimeZone*)tz{
-
-
- TKDateInformation info;
+#pragma mark Date Compontents
+- (NSDateComponents*) dateComponentsWithTimeZone:(NSTimeZone*)timeZone{
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
- [gregorian setTimeZone:tz];
- NSDateComponents