Skip to content

Commit

Permalink
Added delegate method for the "did not select" completion case so the…
Browse files Browse the repository at this point in the history
… delegate can remove the calendar view properly.
  • Loading branch information
Oliver Rickard authored and Oliver Rickard committed Sep 9, 2012
1 parent 30ac4db commit b15b822
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Demo/OCCalendar/OCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ - (void)completedWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate {
calVC = nil;
}

-(void) completedWithNoSelection{
[calVC.view removeFromSuperview];
calVC.delegate = nil;
[calVC release];
calVC = nil;
}


#pragma mark -
#pragma mark Prettifying Methods...
Expand Down
2 changes: 2 additions & 0 deletions OCCalendarView/OCCalendarViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

-(void)completedWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate;

-(void)completedWithNoSelection;

@end

@interface OCCalendarViewController : UIViewController <UIGestureRecognizerDelegate> {
Expand Down
2 changes: 1 addition & 1 deletion OCCalendarView/OCCalendarViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ - (void)removeCalView {
else
[self.delegate completedWithStartDate:endDate endDate:startDate];
} else {
//Do something else if it's not selected.
[self.delegate completedWithNoSelection];
}

[calView removeFromSuperview];
Expand Down

0 comments on commit b15b822

Please sign in to comment.