Skip to content

Commit

Permalink
Add additional functionality to RDVCalendarDayCell, remove RDVCalenda…
Browse files Browse the repository at this point in the history
…rHeaderView.
  • Loading branch information
robbdimitrov committed Nov 1, 2013
1 parent 8c5d2d3 commit b95fdf8
Show file tree
Hide file tree
Showing 18 changed files with 497 additions and 196 deletions.
23 changes: 19 additions & 4 deletions Example/Classes/RDVAppDelegate.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
// RDVAppDelegate.h
// RDVCalendarView
//
// RDVAppDelegate.h
// RDVCalendarView
// Copyright (c) 2013 Robert Dimitrov
//
// Created by Robert Dimitrov on 8/16/13.
// Copyright (c) 2013 Robert Dimitrov. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>

Expand Down
31 changes: 24 additions & 7 deletions Example/Classes/RDVAppDelegate.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
// RDVAppDelegate.m
// RDVCalendarView
//
// RDVAppDelegate.m
// RDVCalendarView
// Copyright (c) 2013 Robert Dimitrov
//
// Created by Robert Dimitrov on 8/16/13.
// Copyright (c) 2013 Robert Dimitrov. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "RDVAppDelegate.h"
#import "RDVCalendarViewController.h"
#import "RDVExampleViewController.h"

@implementation RDVAppDelegate

Expand All @@ -16,10 +31,12 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor];

UIViewController *calendarViewController = [[RDVCalendarViewController alloc] init];
[self.window setRootViewController:calendarViewController];
UIViewController *calendarViewController = [[RDVExampleViewController alloc] init];
UIViewController *navigationController = [[UINavigationController alloc] initWithRootViewController:calendarViewController];
[self.window setRootViewController:navigationController];

[self.window makeKeyAndVisible];

return YES;
}

Expand Down
13 changes: 13 additions & 0 deletions Example/Classes/RDVExampleViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// RDVExampleViewController.h
// RDVCalendarView
//
// Created by Robert Dimitrov on 11/1/13.
// Copyright (c) 2013 Robert Dimitrov. All rights reserved.
//

#import "RDVCalendarViewController.h"

@interface RDVExampleViewController : RDVCalendarViewController

@end
47 changes: 47 additions & 0 deletions Example/Classes/RDVExampleViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// RDVExampleViewController.m
// RDVCalendarView
//
// Copyright (c) 2013 Robert Dimitrov
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "RDVExampleViewController.h"

@interface RDVExampleViewController ()

@end

@implementation RDVExampleViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = @"Calendar";
}
return self;
}

- (void)viewDidLoad {
[super viewDidLoad];

[[self.navigationController navigationBar] setTranslucent:NO];
}

@end
23 changes: 19 additions & 4 deletions Example/main.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
// main.m
// RDVCalendarView
//
// main.m
// RDVCalendarView
// Copyright (c) 2013 Robert Dimitrov
//
// Created by Robert Dimitrov on 8/16/13.
// Copyright (c) 2013 Robert Dimitrov. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>

Expand Down
16 changes: 8 additions & 8 deletions RDVCalendarView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
62C2389217CB463C009B4090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 62C2388817CB463C009B4090 /* InfoPlist.strings */; };
62C2389317CB463C009B4090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 62C2388A17CB463C009B4090 /* main.m */; };
62C2389A17CB472B009B4090 /* RDVAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 62C2389917CB472B009B4090 /* RDVAppDelegate.m */; };
62C2389D17CB4765009B4090 /* RDVCalendarHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 62C2389C17CB4765009B4090 /* RDVCalendarHeaderView.m */; };
62C238A117CB4E97009B4090 /* RDVCalendarWeekDaysHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 62C238A017CB4E97009B4090 /* RDVCalendarWeekDaysHeader.m */; };
62C238A417CB6814009B4090 /* RDVCalendarMonthView.m in Sources */ = {isa = PBXBuildFile; fileRef = 62C238A317CB6814009B4090 /* RDVCalendarMonthView.m */; };
62F77D3617BE0080009873CE /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 62F77D3517BE0080009873CE /* UIKit.framework */; };
Expand All @@ -24,6 +23,7 @@
62F77D5A17BE0105009873CE /* RDVCalendarDayCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 62F77D5917BE0105009873CE /* RDVCalendarDayCell.m */; };
B44421A817BE61A300A048A6 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = B44421A617BE61A300A048A6 /* LICENSE */; };
B44421A917BE61A300A048A6 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = B44421A717BE61A300A048A6 /* README.md */; };
B46DECE11823FE5400D4A823 /* RDVExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B46DECE01823FE5400D4A823 /* RDVExampleViewController.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -36,8 +36,6 @@
62C2388E17CB463C009B4090 /* RDVCalendarView-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RDVCalendarView-Prefix.pch"; sourceTree = "<group>"; };
62C2389817CB472B009B4090 /* RDVAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVAppDelegate.h; sourceTree = "<group>"; };
62C2389917CB472B009B4090 /* RDVAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVAppDelegate.m; sourceTree = "<group>"; };
62C2389B17CB4765009B4090 /* RDVCalendarHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVCalendarHeaderView.h; sourceTree = "<group>"; };
62C2389C17CB4765009B4090 /* RDVCalendarHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVCalendarHeaderView.m; sourceTree = "<group>"; };
62C2389F17CB4E97009B4090 /* RDVCalendarWeekDaysHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVCalendarWeekDaysHeader.h; sourceTree = "<group>"; };
62C238A017CB4E97009B4090 /* RDVCalendarWeekDaysHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVCalendarWeekDaysHeader.m; sourceTree = "<group>"; };
62C238A217CB6813009B4090 /* RDVCalendarMonthView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RDVCalendarMonthView.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
Expand All @@ -54,6 +52,8 @@
62F77D5917BE0105009873CE /* RDVCalendarDayCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVCalendarDayCell.m; sourceTree = "<group>"; };
B44421A617BE61A300A048A6 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
B44421A717BE61A300A048A6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
B46DECDF1823FE5400D4A823 /* RDVExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVExampleViewController.h; sourceTree = "<group>"; };
B46DECE01823FE5400D4A823 /* RDVExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVExampleViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -98,6 +98,8 @@
children = (
62C2389817CB472B009B4090 /* RDVAppDelegate.h */,
62C2389917CB472B009B4090 /* RDVAppDelegate.m */,
B46DECDF1823FE5400D4A823 /* RDVExampleViewController.h */,
B46DECE01823FE5400D4A823 /* RDVExampleViewController.m */,
);
path = Classes;
sourceTree = "<group>";
Expand Down Expand Up @@ -141,8 +143,6 @@
62F77D5617BE00BB009873CE /* RDVCalendarView.m */,
62F77D5817BE0105009873CE /* RDVCalendarDayCell.h */,
62F77D5917BE0105009873CE /* RDVCalendarDayCell.m */,
62C2389B17CB4765009B4090 /* RDVCalendarHeaderView.h */,
62C2389C17CB4765009B4090 /* RDVCalendarHeaderView.m */,
62C2389F17CB4E97009B4090 /* RDVCalendarWeekDaysHeader.h */,
62C238A017CB4E97009B4090 /* RDVCalendarWeekDaysHeader.m */,
62C238A217CB6813009B4090 /* RDVCalendarMonthView.h */,
Expand Down Expand Up @@ -224,7 +224,7 @@
62F77D5A17BE0105009873CE /* RDVCalendarDayCell.m in Sources */,
62C2389317CB463C009B4090 /* main.m in Sources */,
62C2389A17CB472B009B4090 /* RDVAppDelegate.m in Sources */,
62C2389D17CB4765009B4090 /* RDVCalendarHeaderView.m in Sources */,
B46DECE11823FE5400D4A823 /* RDVExampleViewController.m in Sources */,
62C238A117CB4E97009B4090 /* RDVCalendarWeekDaysHeader.m in Sources */,
62C238A417CB6814009B4090 /* RDVCalendarMonthView.m in Sources */,
);
Expand Down Expand Up @@ -310,7 +310,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example/RDVCalendarView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -323,7 +323,7 @@
INFOPLIST_FILE = "$(SRCROOT)/Example/RDVCalendarView-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
TARGETED_DEVICE_FAMILY = "1,2";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
81 changes: 70 additions & 11 deletions RDVCalendarView/RDVCalendarDayCell.h
Original file line number Diff line number Diff line change
@@ -1,34 +1,93 @@
// RDVCalendarDayCell.h
// RDVCalendarView
//
// RDVCalendarDayCell.h
// RDVCalendarView
// Copyright (c) 2013 Robert Dimitrov
//
// Created by Robert Dimitrov on 8/16/13.
// Copyright (c) 2013 Robert Dimitrov. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, RDVCalendarDayCellSelectionStyle) {
RDVCalendarDayCellSelectionStyleNone,
RDVCalendarDayCellSelectionStyleNormal,
RDVCalendarDayCellSelectionStyleDefault,
};

@interface RDVCalendarDayCell : UIView

/**
* A string used to identify a day cell that is reusable. (read-only)
*/
@property(nonatomic, readonly, copy) NSString *reuseIdentifier;

@property (nonatomic, readonly) UILabel *titleLabel;
@property (nonatomic) UIView *contentView;
@property (nonatomic) UIView *backgroundView;
@property (nonatomic) UIView *selectedBackgroundView;
/**
* Returns the label used for the main textual content of the day cell. (read-only)
*/
@property (nonatomic, readonly) UILabel *textLabel;

/**
* Returns the content view of the day cell object. (read-only)
*/
@property (nonatomic, readonly) UIView *contentView;

/**
* The view used as the background of the day cell.
*/
@property (nonatomic, strong) UIView *backgroundView;

/**
* The view used as the background of the day cell when it is selected.
*/
@property (nonatomic, strong) UIView *selectedBackgroundView;

/**
* The style of selection for a cell.
*/
@property(nonatomic) RDVCalendarDayCellSelectionStyle selectionStyle;

/**
* A Boolean value that indicates whether the cell is selected.
*/
@property(nonatomic, getter = isSelected) BOOL selected;

- (id)initWithStyle:(RDVCalendarDayCellSelectionStyle)style reuseIdentifier:(NSString *)reuseIdentifier;
/**
* A Boolean value that indicates whether the cell is highlighted.
*/
@property(nonatomic, getter = isHighlighted) BOOL highlighted;

/**
* Initializes a day cell with a reuse identifier and returns it to the caller.
*/
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;

/**
* Sets the selected state of the cell, optionally animating the transition between states.
*/
- (void)setSelected:(BOOL)selected animated:(BOOL)animated;
- (void)setSelected:(BOOL)selected;

/**
* Sets the highlighted state of the cell, optionally animating the transition between states.
*/
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated;

/**
* Prepares a reusable day cell for reuse by the calendar view.
*/
- (void)prepareForReuse;

@end
Loading

0 comments on commit b95fdf8

Please sign in to comment.