Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar Month Grid: Custom image support #172

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 44 additions & 0 deletions demo/iPhone/DemoCalendarMonth.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,49 @@ - (void) generateRandomDataForStartDate:(NSDate*)start endDate:(NSDate*)end{

}

- (UIImage *) rightArrowForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImage *) leftArrowForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImageView *) topBarForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImageView *) shadowForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImage *) dateTileForMonthView:(TKCalendarMonthView*)monthView;
{
return nil;
}

- (UIImage *) todayTileForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImage *) selectedTileForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImage *) todaySelectedTileForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

- (UIImage *) hoverTileForMonthView:(TKCalendarMonthView*)monthView
{
return nil;
}

@end
62 changes: 60 additions & 2 deletions src/TapkuLibrary/TKCalendarMonthView.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@


@class TKCalendarMonthTiles;
@protocol TKCalendarMonthViewDelegate, TKCalendarMonthViewDataSource;
@protocol TKCalendarMonthViewDelegate, TKCalendarMonthViewDataSource, TKCalendarMonthTilesDelegate;

/** `TKCalendarMonthView` imitates the month grid in the Calendar app on iPhone. */
@interface TKCalendarMonthView : UIView {
@interface TKCalendarMonthView : UIView<TKCalendarMonthTilesDelegate> {

TKCalendarMonthTiles *currentTile,*oldTile;
UIButton *leftArrow, *rightArrow;
Expand All @@ -61,6 +61,9 @@
/** The data soruce must adopt the `TKCalendarMonthViewDataSource` protocol. The data source is not retained. */
@property (nonatomic,assign) id <TKCalendarMonthViewDataSource> dataSource;

/** Title label from the top of the calendar available to move, style etc */
@property (nonatomic, assign) UILabel *monthYear;

/** The current date highlighted on the month grid.
@return An `NSDate` object set to the month, year and day of the current selection.
*/
Expand Down Expand Up @@ -114,6 +117,60 @@
@param animated Animation flag
*/
- (void) calendarMonthView:(TKCalendarMonthView*)monthView monthDidChange:(NSDate*)month animated:(BOOL)animated;

/** A custom UIImage to use as the right arrow
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) rightArrowForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImage to use as the left arrow
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) leftArrowForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImageView to use as the top bar image
@param monthView The calendar month view.
@return UIImageView if required, nil otherwise
*/
- (UIImageView *) topBarForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImageView to use as the shadow
@param monthView The calendar month view.
@return UIImageView if required, nil otherwise
*/
- (UIImageView *) shadowForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImage to use as the default date tile
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) dateTileForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImage to use as the today tile when not selected
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) todayTileForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImage to use as the selected tile
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) selectedTileForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImage to use as the selected tile when the date is today
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) todaySelectedTileForMonthView:(TKCalendarMonthView*)monthView;

/** A custom UIImage to use as the tile to use when a day outside the current month is selected
@param monthView The calendar month view.
@return UIImage if required, nil otherwise
*/
- (UIImage *) hoverTileForMonthView:(TKCalendarMonthView*)monthView;
@end


Expand All @@ -129,4 +186,5 @@

*/
- (NSArray*) calendarMonthView:(TKCalendarMonthView*)monthView marksFromDate:(NSDate*)startDate toDate:(NSDate*)lastDate;

@end
Loading