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

Weekly calendar view #57

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ TapkuLibrary
============
TapkuLibrary is an open source iOS framework built on Cocoa and UIKit intended for broad use in applications. If you really like the framework, [drop me a line](http://devinsheaven.com/about#contact), I'd love to hear about it. Many thanks to those who have contributed to the project.

### Fieldforce Fork

We're adding a weekly view to the calendar, extending the TKCalendarDayView, work in progress screenshot below.
![5 or 7 Day Weekly Calendar View](https://github.com/fieldforceapp/tapkulibrary/blob/master/Screenshot_01.png)


### Classes

Expand Down
Binary file added Screenshot_01.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
115 changes: 115 additions & 0 deletions src/TapkuLibrary/TKCalendarWeekTimelineView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
//
// TKCalendarWeekTimelineView.h
// Based on TKCalendarDayTimelineView by Devin Ross.
/*

tapku.com || http://github.com/devinross/tapkulibrary

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>
#import "TKCalendarDayEventView.h"

@protocol TKCalendarWeekTimelineViewDelegate;

@class TKTimelineWeekView;

@interface TKCalendarWeekTimelineView : UIView <TapDetectingViewDelegate,UIGestureRecognizerDelegate> {
UIScrollView *_scrollView;
TKTimelineWeekView *_timelineView;

NSArray *_events;
NSDate *_currentDay;
NSDate *_beginningOfWeek;

id <TKCalendarWeekTimelineViewDelegate> _delegate;
UIColor *timelineColor;
UIColor *hourColor;
BOOL is24hClock;
BOOL isFirstDayMonday;
BOOL isFiveDayWeek;
//montagem da barra superior de seleção de dias
UIButton *leftArrow, *rightArrow;
UIImageView *topBackground, *shadow;
UILabel *monthYear;
UILabel *day1, *day2, *day3, *day4, *day5, *day6, *day7;
}

@property (nonatomic, readonly) UIScrollView *scrollView;
@property (nonatomic, readonly) TKTimelineWeekView *timelineView;

@property (nonatomic, retain) NSArray *events;
@property (nonatomic, copy) NSDate *currentDay;
@property (nonatomic, retain) NSDate *beginningOfWeek;

@property (nonatomic, retain) id <TKCalendarWeekTimelineViewDelegate> delegate;

@property (nonatomic, retain) UIColor *timelineColor;
@property (nonatomic, retain) UIColor *hourColor;
@property (nonatomic) BOOL is24hClock;
@property (nonatomic) BOOL isFiveDayWeek;

// Initialisation
- (void)setupCustomInitialisation;
- (void) addSubviewDayLabels;
- (UILabel *) dayLabel:(UILabel *)uilabel inRect:(CGRect)r;
- (CGRect) getViewRectForDay:(int)day;
- (NSDate*)getTimeAndDayFromPoint:(CGPoint)tapPoint;
- (void) setupGestureRecognition;

// Reload Day
- (void)reloadDay;

@end

@protocol TKCalendarWeekTimelineViewDelegate<NSObject>
@required

- (NSArray *) calendarWeekTimelineView:(TKCalendarWeekTimelineView*)calendarWeekTimeline eventsForDate:(NSDate *)eventDate;

@optional
- (void) calendarWeekTimelineView:(TKCalendarWeekTimelineView*)calendarWeekTimeline eventViewWasSelected:(TKCalendarDayEventView *)eventView;
- (void) calendarWeekTimelineView:(TKCalendarWeekTimelineView*)calendarWeekTimeline eventDateWasSelected:(NSDate*)eventDate;

@end

@interface TKTimelineWeekView : TapDetectingView {
NSArray *_times;
NSArray *_periods;
BOOL is24hClock;
BOOL isFiveDayWeek;
UIColor *hourColor;
}

@property (nonatomic, readonly) NSArray *times;
@property (nonatomic, readonly) NSArray *periods;
@property (nonatomic, retain) UIColor *hourColor;
@property (nonatomic) BOOL is24hClock;
@property (nonatomic) BOOL isFiveDayWeek;

// Initialisation
- (void)setupCustomInitialisation;
- (CGRect) getViewRectForDay:(int)day;

@end