Skip to content
This repository was archived by the owner on Mar 15, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
544b334
Update gitignore.
desplesda Aug 23, 2012
387b026
Update base SDK to latest iOS. Convert to ARC and modern ObjC syntax.
desplesda Aug 23, 2012
15165a6
If events intersect, lay them out side-by-side.
desplesda Aug 23, 2012
f88dada
Rename GCCalendarView to GCCalendarViewController.
desplesda Aug 23, 2012
5b5f677
Rename GCCalendarPortraitView to GCCalendarPortraitViewController.
desplesda Aug 23, 2012
c3deb63
Update .gitignore.
desplesda Aug 23, 2012
e7324cd
Rename GCCalendarTile to GCCalendarTileView
desplesda Aug 23, 2012
888503c
Fix a compile error
desplesda Aug 23, 2012
23d6417
Update view controller to work better in a nib-based workflow.
desplesda Aug 23, 2012
ef8ad8f
Make GCCalendarPortraitViewController able to reload its data
desplesda Aug 23, 2012
d9a69b9
Don't set the view controller's title. Leave that up to the host app.
desplesda Aug 24, 2012
5b0d0e4
Events can now display an image.
desplesda Aug 26, 2012
06e6bb7
Improve the spacing between the event image and title.
desplesda Aug 26, 2012
1ea733f
Remove unnecessary logging
desplesda Aug 26, 2012
47d1a9b
Make (most of) the calendar view themable through the use of delegate…
desplesda Aug 27, 2012
e16b6cf
Numerous look and feel enhancements
desplesda Aug 29, 2012
11a00a7
Add some files that were missing from last commit
desplesda Aug 29, 2012
5b2ce43
Adjust some details.
desplesda Aug 29, 2012
5d3c77c
Don't make EAGlossyBoxes go weird when they're inside a UITableViewCe…
desplesda Aug 29, 2012
6bfb128
Events that are immediately following each other do not count as inte…
desplesda Sep 1, 2012
7ec78c0
Add spacing between events.
desplesda Sep 1, 2012
df3f8aa
Mondo chango
desplesda Sep 4, 2012
e592a1b
Animated scrolling when moving to now
desplesda Sep 4, 2012
538464f
Improve the behaviour of the Now button
desplesda Sep 4, 2012
4bb458b
Even nicer behaviour for the Now button
desplesda Sep 4, 2012
477c3c1
Don't enable the back/next buttons unnecessarily when the calendar is…
desplesda Sep 5, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
.DS_Store
.svn/
build/
# Xcode
*.DS_Store
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
46 changes: 26 additions & 20 deletions Calendar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
3B96AA7D1139BC99003FF405 /* GCCalendar.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA621139BC99003FF405 /* GCCalendar.m */; };
3B96AA7E1139BC99003FF405 /* GCCalendarDayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA641139BC99003FF405 /* GCCalendarDayView.m */; };
3B96AA7F1139BC99003FF405 /* GCCalendarEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA661139BC99003FF405 /* GCCalendarEvent.m */; };
3B96AA801139BC99003FF405 /* GCCalendarPortraitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA681139BC99003FF405 /* GCCalendarPortraitView.m */; };
3B96AA811139BC99003FF405 /* GCCalendarTile.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA6B1139BC99003FF405 /* GCCalendarTile.m */; };
3B96AA821139BC99003FF405 /* GCCalendarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA6D1139BC99003FF405 /* GCCalendarView.m */; };
3B96AA801139BC99003FF405 /* GCCalendarPortraitViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA681139BC99003FF405 /* GCCalendarPortraitViewController.m */; };
3B96AA811139BC99003FF405 /* GCCalendarTileView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA6B1139BC99003FF405 /* GCCalendarTileView.m */; };
3B96AA821139BC99003FF405 /* GCCalendarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA6D1139BC99003FF405 /* GCCalendarViewController.m */; };
3B96AA831139BC99003FF405 /* GCDatePickerControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B96AA6F1139BC99003FF405 /* GCDatePickerControl.m */; };
3B96AA841139BC99003FF405 /* GCDatePickerControlBackground.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B96AA701139BC99003FF405 /* GCDatePickerControlBackground.png */; };
3B96AA851139BC99003FF405 /* GCDatePickerControlLeft.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B96AA711139BC99003FF405 /* GCDatePickerControlLeft.png */; };
Expand Down Expand Up @@ -59,13 +59,13 @@
3B96AA641139BC99003FF405 /* GCCalendarDayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarDayView.m; sourceTree = "<group>"; };
3B96AA651139BC99003FF405 /* GCCalendarEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarEvent.h; sourceTree = "<group>"; };
3B96AA661139BC99003FF405 /* GCCalendarEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarEvent.m; sourceTree = "<group>"; };
3B96AA671139BC99003FF405 /* GCCalendarPortraitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarPortraitView.h; sourceTree = "<group>"; };
3B96AA681139BC99003FF405 /* GCCalendarPortraitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarPortraitView.m; sourceTree = "<group>"; };
3B96AA671139BC99003FF405 /* GCCalendarPortraitViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarPortraitViewController.h; sourceTree = "<group>"; };
3B96AA681139BC99003FF405 /* GCCalendarPortraitViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarPortraitViewController.m; sourceTree = "<group>"; };
3B96AA691139BC99003FF405 /* GCCalendarProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarProtocols.h; sourceTree = "<group>"; };
3B96AA6A1139BC99003FF405 /* GCCalendarTile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarTile.h; sourceTree = "<group>"; };
3B96AA6B1139BC99003FF405 /* GCCalendarTile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarTile.m; sourceTree = "<group>"; };
3B96AA6C1139BC99003FF405 /* GCCalendarView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarView.h; sourceTree = "<group>"; };
3B96AA6D1139BC99003FF405 /* GCCalendarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarView.m; sourceTree = "<group>"; };
3B96AA6A1139BC99003FF405 /* GCCalendarTileView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarTileView.h; sourceTree = "<group>"; };
3B96AA6B1139BC99003FF405 /* GCCalendarTileView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarTileView.m; sourceTree = "<group>"; };
3B96AA6C1139BC99003FF405 /* GCCalendarViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCCalendarViewController.h; sourceTree = "<group>"; };
3B96AA6D1139BC99003FF405 /* GCCalendarViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCCalendarViewController.m; sourceTree = "<group>"; };
3B96AA6E1139BC99003FF405 /* GCDatePickerControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDatePickerControl.h; sourceTree = "<group>"; };
3B96AA6F1139BC99003FF405 /* GCDatePickerControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCDatePickerControl.m; sourceTree = "<group>"; };
3B96AA701139BC99003FF405 /* GCDatePickerControlBackground.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = GCDatePickerControlBackground.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -165,13 +165,13 @@
3B96AA641139BC99003FF405 /* GCCalendarDayView.m */,
3B96AA651139BC99003FF405 /* GCCalendarEvent.h */,
3B96AA661139BC99003FF405 /* GCCalendarEvent.m */,
3B96AA671139BC99003FF405 /* GCCalendarPortraitView.h */,
3B96AA681139BC99003FF405 /* GCCalendarPortraitView.m */,
3B96AA671139BC99003FF405 /* GCCalendarPortraitViewController.h */,
3B96AA681139BC99003FF405 /* GCCalendarPortraitViewController.m */,
3B96AA691139BC99003FF405 /* GCCalendarProtocols.h */,
3B96AA6A1139BC99003FF405 /* GCCalendarTile.h */,
3B96AA6B1139BC99003FF405 /* GCCalendarTile.m */,
3B96AA6C1139BC99003FF405 /* GCCalendarView.h */,
3B96AA6D1139BC99003FF405 /* GCCalendarView.m */,
3B96AA6A1139BC99003FF405 /* GCCalendarTileView.h */,
3B96AA6B1139BC99003FF405 /* GCCalendarTileView.m */,
3B96AA6C1139BC99003FF405 /* GCCalendarViewController.h */,
3B96AA6D1139BC99003FF405 /* GCCalendarViewController.m */,
3B96AA6E1139BC99003FF405 /* GCDatePickerControl.h */,
3B96AA6F1139BC99003FF405 /* GCDatePickerControl.m */,
3B96AA701139BC99003FF405 /* GCDatePickerControlBackground.png */,
Expand Down Expand Up @@ -208,7 +208,11 @@
isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Calendar" */;
compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -251,9 +255,9 @@
3B96AA7D1139BC99003FF405 /* GCCalendar.m in Sources */,
3B96AA7E1139BC99003FF405 /* GCCalendarDayView.m in Sources */,
3B96AA7F1139BC99003FF405 /* GCCalendarEvent.m in Sources */,
3B96AA801139BC99003FF405 /* GCCalendarPortraitView.m in Sources */,
3B96AA811139BC99003FF405 /* GCCalendarTile.m in Sources */,
3B96AA821139BC99003FF405 /* GCCalendarView.m in Sources */,
3B96AA801139BC99003FF405 /* GCCalendarPortraitViewController.m in Sources */,
3B96AA811139BC99003FF405 /* GCCalendarTileView.m in Sources */,
3B96AA821139BC99003FF405 /* GCCalendarViewController.m in Sources */,
3B96AA831139BC99003FF405 /* GCDatePickerControl.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -277,6 +281,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand All @@ -291,6 +296,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Calendar_Prefix.pch;
Expand All @@ -308,7 +314,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos3.1.2;
SDKROOT = iphoneos;
};
name = Debug;
};
Expand All @@ -321,7 +327,7 @@
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = iphoneos3.1.2;
SDKROOT = iphoneos;
};
name = Release;
};
Expand Down
36 changes: 25 additions & 11 deletions Classes/CalendarAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ @implementation CalendarAppDelegate

- (void)applicationDidFinishLaunching:(UIApplication *)application {
// create calendar view
GCCalendarPortraitView *calendar = [[[GCCalendarPortraitView alloc] init] autorelease];
GCCalendarPortraitViewController *calendar = [[GCCalendarPortraitViewController alloc] init];
calendar.dataSource = self;
calendar.delegate = self;
calendar.hasAddButton = YES;

// create navigation view
UINavigationController *nav = [[[UINavigationController alloc] initWithRootViewController:calendar] autorelease];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:calendar];

// create tab controller
tabController = [[UITabBarController alloc] init];
tabController.viewControllers = [NSArray arrayWithObject:nav];
tabController.viewControllers = @[nav];

// setup window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
Expand All @@ -32,13 +32,10 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {


- (void)dealloc {
[window release];
window = nil;

[tabController release];
tabController = nil;

[super dealloc];
}

#pragma mark GCCalendarDataSource
Expand Down Expand Up @@ -68,7 +65,6 @@ - (NSArray *)calendarEventsForDate:(NSDate *)date {
event.endDate = [[NSCalendar currentCalendar] dateFromComponents:components];

[events addObject:event];
[event release];
}


Expand All @@ -83,23 +79,41 @@ - (NSArray *)calendarEventsForDate:(NSDate *)date {
[components setHour:20];
evt.endDate = [[NSCalendar currentCalendar] dateFromComponents:components];
[events addObject:evt];
[evt release];

evt = [[GCCalendarEvent alloc] init];
evt.eventName = @"Test event";
evt.eventDescription = @"Description for test event. This is intentionnaly too long to stay on a single line.";
[components setHour:17];
[components setMinute:0];
evt.startDate = [[NSCalendar currentCalendar] dateFromComponents:components];
[components setHour:20];
evt.endDate = [[NSCalendar currentCalendar] dateFromComponents:components];
[events addObject:evt];

evt = [[GCCalendarEvent alloc] init];
evt.eventName = @"Test event";
[components setHour:19];
[components setMinute:0];
evt.startDate = [[NSCalendar currentCalendar] dateFromComponents:components];
[components setHour:20];
[components setMinute:30];
evt.endDate = [[NSCalendar currentCalendar] dateFromComponents:components];
[events addObject:evt];

// create an all day event
GCCalendarEvent *event = [[GCCalendarEvent alloc] init];
event.allDayEvent = YES;
event.eventName = @"All Day Event";
[events addObject:event];
[event release];

return events;
}

#pragma mark GCCalendarDelegate
- (void)calendarTileTouchedInView:(GCCalendarView *)view withEvent:(GCCalendarEvent *)event {
- (void)calendarTileTouchedInView:(GCCalendarViewController *)view withEvent:(GCCalendarEvent *)event {
NSLog(@"Touch event %@", event.eventName);
}
- (void)calendarViewAddButtonPressed:(GCCalendarView *)view {
- (void)calendarViewAddButtonPressed:(GCCalendarViewController *)view {
NSLog(@"%s", __PRETTY_FUNCTION__);
}

Expand Down
Binary file added GCCalendar/Calendar-Tile-Base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added GCCalendar/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed GCCalendar/CalendarBubbleBlue.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubbleGreen.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubbleGrey.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubbleMagenta.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubbleOrange.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubblePurple.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubbleRed.png
Binary file not shown.
Binary file removed GCCalendar/CalendarBubbleYellow.png
Binary file not shown.
17 changes: 17 additions & 0 deletions GCCalendar/EAGlossyBox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// EAGlossyBox.h
// EventApp
//
// Created by Jon Manning on 29/08/12.
// Copyright (c) 2012 Secret Lab. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface EAGlossyBox : UIView

@property (assign) CGFloat radius;

- (void) setColor:(UIColor*)color;

@end
62 changes: 62 additions & 0 deletions GCCalendar/EAGlossyBox.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// EAGlossyBox.m
// EventApp
//
// Created by Jon Manning on 29/08/12.
// Copyright (c) 2012 Secret Lab. All rights reserved.
//

#import "EAGlossyBox.h"
#import <QuartzCore/QuartzCore.h>

@interface EAGlossyBox () {
UIImageView* _glossImage;
}

@end

@implementation EAGlossyBox

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
self.layer.cornerRadius = 5;
self.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.2].CGColor;
self.layer.borderWidth = 1;


_glossImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Calendar-Tile-Gloss-Pattern"]];
[self addSubview:_glossImage];
self.clipsToBounds = YES;

}
return self;
}

// If we're in a UITableViewCell, when selected we appear to receive
// a call to setBackgroundColor: that sets our color to clear.
// We only want to do this when the 'color' property is set,
// so ignore this call.
- (void)setBackgroundColor:(UIColor *)backgroundColor {

}

- (void)setColor:(UIColor *)color {
[super setBackgroundColor:color];
}

- (void)layoutSubviews {
_glossImage.frame = CGRectMake(0, 0, CGRectGetWidth(self.frame), CGRectGetHeight(_glossImage.bounds));
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/

@end
16 changes: 16 additions & 0 deletions GCCalendar/EATintedImageView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// EATintedImageView.h
// EventApp
//
// Created by Jon Manning on 28/08/12.
// Copyright (c) 2012 Secret Lab. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface EATintedImageView : UIView

@property (strong) UIImage* image;
@property (strong) UIColor* overlayColor;

@end
46 changes: 46 additions & 0 deletions GCCalendar/EATintedImageView.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// EATintedImageView.m
// EventApp
//
// Created by Jon Manning on 28/08/12.
// Copyright (c) 2012 Secret Lab. All rights reserved.
//

#import "EATintedImageView.h"

@implementation EATintedImageView

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
}
return self;
}

- (void) drawRect:(CGRect)area
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context);

[self.image drawInRect:self.bounds];

if (self.overlayColor) {
CGContextSetBlendMode (context, kCGBlendModeHue);
CGContextSetFillColor(context, CGColorGetComponents(self.overlayColor.CGColor));
CGContextFillRect (context, self.bounds);
}
CGContextRestoreGState(context);
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/

@end
4 changes: 2 additions & 2 deletions GCCalendar/GCCalendar.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#import <UIKit/UIKit.h>

#import "GCCalendarView.h"
#import "GCCalendarViewController.h"
#import "GCCalendarEvent.h"
#import "GCCalendarProtocols.h"
#import "GCCalendarPortraitView.h"
#import "GCCalendarPortraitViewController.h"

// calendar notificaions
static NSString * const GCCalendarShouldReloadNotification = @"GCCalendarShouldReload";
Expand Down
2 changes: 1 addition & 1 deletion GCCalendar/GCCalendar.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ + (NSDateFormatter *)timeFormatter {
#pragma mark color list
+ (NSArray *)colors {
if (colors == nil) {
colors = [[NSArray arrayWithObjects:@"BLUE", @"GREEN", @"ORANGE", @"MAGENTA", @"PURPLE", @"RED", @"YELLOW", nil] retain];
colors = @[@"BLUE", @"GREEN", @"ORANGE", @"MAGENTA", @"PURPLE", @"RED", @"YELLOW"];
}

return colors;
Expand Down
Loading