Skip to content

Commit

Permalink
Update description, add screenshots, add separatorEdgeInsets and dayC…
Browse files Browse the repository at this point in the history
…ellEdgeInsets properties to Calendar view.
  • Loading branch information
robbdimitrov committed Nov 3, 2013
1 parent 6d68b71 commit 8d2b9f0
Show file tree
Hide file tree
Showing 12 changed files with 352 additions and 130 deletions.
30 changes: 30 additions & 0 deletions Example/Classes/RDVExampleDayCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// RDVExampleDayCell.h
// 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 "RDVCalendarDayCell.h"

@interface RDVExampleDayCell : RDVCalendarDayCell

@property (nonatomic) UIView *notificationView;

@end
52 changes: 52 additions & 0 deletions Example/Classes/RDVExampleDayCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// RDVExampleDayCell.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 "RDVExampleDayCell.h"

@implementation RDVExampleDayCell

- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithReuseIdentifier:reuseIdentifier];
if (self) {
_notificationView = [[UIView alloc] init];
[_notificationView setBackgroundColor:[UIColor blueColor]];
[_notificationView setHidden:YES];
[self.contentView addSubview:_notificationView];
}
return self;
}

- (void)layoutSubviews {
[super layoutSubviews];

CGSize viewSize = self.contentView.frame.size;

[[self notificationView] setFrame:CGRectMake(viewSize.width - 10, 0, 10, 10)];
}

- (void)prepareForReuse {
[[self notificationView] setHidden:YES];
}

@end
11 changes: 11 additions & 0 deletions Example/Classes/RDVExampleViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
// THE SOFTWARE.

#import "RDVExampleViewController.h"
#import "RDVExampleDayCell.h"

@interface RDVExampleViewController ()

Expand All @@ -42,6 +43,16 @@ - (void)viewDidLoad {
[super viewDidLoad];

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

[[self calendarView] registerDayCellClass:[RDVExampleDayCell class]];
}

- (void)calendarView:(RDVCalendarView *)calendarView configureDayCell:(RDVCalendarDayCell *)dayCell
atIndex:(NSInteger)index {
RDVExampleDayCell *exampleDayCell = (RDVExampleDayCell *)dayCell;
if (index % 5 == 0) {
[[exampleDayCell notificationView] setHidden:NO];
}
}

@end
30 changes: 30 additions & 0 deletions RDVCalendarView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
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 */; };
B463BCB618265F0400BF5848 /* iPad-small.png in Resources */ = {isa = PBXBuildFile; fileRef = B463BCB218265F0400BF5848 /* iPad-small.png */; };
B463BCB718265F0400BF5848 /* iPad.png in Resources */ = {isa = PBXBuildFile; fileRef = B463BCB318265F0400BF5848 /* iPad.png */; };
B463BCB818265F0400BF5848 /* iPhone-small.png in Resources */ = {isa = PBXBuildFile; fileRef = B463BCB418265F0400BF5848 /* iPhone-small.png */; };
B463BCB918265F0400BF5848 /* iPhone.png in Resources */ = {isa = PBXBuildFile; fileRef = B463BCB518265F0400BF5848 /* iPhone.png */; };
B463BCBD1826682B00BF5848 /* RDVExampleDayCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B463BCBB1826673500BF5848 /* RDVExampleDayCell.m */; };
B46DECE11823FE5400D4A823 /* RDVExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B46DECE01823FE5400D4A823 /* RDVExampleViewController.m */; };
/* End PBXBuildFile section */

Expand All @@ -46,6 +51,12 @@
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>"; };
B463BCB218265F0400BF5848 /* iPad-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad-small.png"; sourceTree = "<group>"; };
B463BCB318265F0400BF5848 /* iPad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = iPad.png; sourceTree = "<group>"; };
B463BCB418265F0400BF5848 /* iPhone-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPhone-small.png"; sourceTree = "<group>"; };
B463BCB518265F0400BF5848 /* iPhone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = iPhone.png; sourceTree = "<group>"; };
B463BCBA1826673500BF5848 /* RDVExampleDayCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVExampleDayCell.h; sourceTree = "<group>"; };
B463BCBB1826673500BF5848 /* RDVExampleDayCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVExampleDayCell.m; 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 */
Expand Down Expand Up @@ -94,6 +105,8 @@
62C2389917CB472B009B4090 /* RDVAppDelegate.m */,
B46DECDF1823FE5400D4A823 /* RDVExampleViewController.h */,
B46DECE01823FE5400D4A823 /* RDVExampleViewController.m */,
B463BCBA1826673500BF5848 /* RDVExampleDayCell.h */,
B463BCBB1826673500BF5848 /* RDVExampleDayCell.m */,
);
path = Classes;
sourceTree = "<group>";
Expand All @@ -103,6 +116,7 @@
children = (
B44421A617BE61A300A048A6 /* LICENSE */,
B44421A717BE61A300A048A6 /* README.md */,
B463BCB118265F0400BF5848 /* Screenshots */,
62F77D3B17BE0080009873CE /* RDVCalendarView */,
62C2388417CB463C009B4090 /* Example */,
62F77D3417BE0080009873CE /* Frameworks */,
Expand Down Expand Up @@ -141,6 +155,17 @@
path = RDVCalendarView;
sourceTree = "<group>";
};
B463BCB118265F0400BF5848 /* Screenshots */ = {
isa = PBXGroup;
children = (
B463BCB218265F0400BF5848 /* iPad-small.png */,
B463BCB318265F0400BF5848 /* iPad.png */,
B463BCB418265F0400BF5848 /* iPhone-small.png */,
B463BCB518265F0400BF5848 /* iPhone.png */,
);
path = Screenshots;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -193,7 +218,11 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B463BCB918265F0400BF5848 /* iPhone.png in Resources */,
B44421A817BE61A300A048A6 /* LICENSE in Resources */,
B463BCB718265F0400BF5848 /* iPad.png in Resources */,
B463BCB818265F0400BF5848 /* iPhone-small.png in Resources */,
B463BCB618265F0400BF5848 /* iPad-small.png in Resources */,
B44421A917BE61A300A048A6 /* README.md in Resources */,
62C2388F17CB463C009B4090 /* [email protected] in Resources */,
62C2389017CB463C009B4090 /* Default.png in Resources */,
Expand All @@ -214,6 +243,7 @@
62F77D5A17BE0105009873CE /* RDVCalendarDayCell.m in Sources */,
62C2389317CB463C009B4090 /* main.m in Sources */,
62C2389A17CB472B009B4090 /* RDVAppDelegate.m in Sources */,
B463BCBD1826682B00BF5848 /* RDVExampleDayCell.m in Sources */,
B46DECE11823FE5400D4A823 /* RDVExampleViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
12 changes: 11 additions & 1 deletion RDVCalendarView/RDVCalendarView.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ typedef NS_ENUM(NSInteger, RDVCalendarViewDayCellSeparatorType) {
*/
@property(nonatomic, retain) UIColor *separatorColor;

/**
* The inset or outset margins for the rectangle around the separators.
*/
@property (nonatomic) UIEdgeInsets separatorEdgeInsets;

/**
* The inset or outset margins for the rectangle surrounding the day cells.
*/
@property (nonatomic) UIEdgeInsets dayCellEdgeInsets;

/**
* Returns the currently selected date.
*/
Expand Down Expand Up @@ -120,7 +130,7 @@ typedef NS_ENUM(NSInteger, RDVCalendarViewDayCellSeparatorType) {
*/
- (id)dequeueReusableCellWithIdentifier:(NSString *)identifier;

#pragma mark - Accessing Cells
#pragma mark - Accessing Day Cells

/**
* Returns the table cells that are visible in the receiver.
Expand Down
Loading

0 comments on commit 8d2b9f0

Please sign in to comment.