Giter Club home page Giter Club logo

clweeklycalendarview's Introduction

#CLWeeklyCalendarView

CLWeeklyCalendarView is a scrollable weekly calendarView for iPhone. It is easy to use and customised.

alt tag

Installation

If you are using CocoaPods you can use this for the time being:

pod 'CLWeeklyCalendarView'

Manually:

  • Drag the CLWeeklyCalendarViewSource folder into your project.

Initialize

Using CLWeeklyCalendarViewSource in your app will usually look as simple as this :

//Initialize
-(CLWeeklyCalendarView *)calendarView
{
    if(!_calendarView){
        _calendarView = [[CLWeeklyCalendarView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 100)];
        _calendarView.delegate = self;
    }
    return _calendarView;
}

//Add it into parentView
[self.view addSubview:self.calendarView];

Delegate

After the date in the calendar has been selected , following delegate function will be fired

//After getting data callback
-(void)dailyCalendarViewDidSelect:(NSDate *)date
{
    //You can do any logic after the view select the date
}

You can delegate to tell the calenderView scrollTo specified date by using following delegate function

- (void)redrawToDate: (NSDate *)dt;

UI Customisation

**Please be aware customisation method is optional, if u do not apply it, it will just fire the default value.

The following customisation key is allowed:

CLCalendarWeekStartDay;    //The Day of weekStart from 1 - 7 - Default: 1
CLCalendarDayTitleTextColor; //Day Title text color,  Mon, Tue, etc label text color
CLCalendarPastDayNumberTextColor;    //Day number text color for dates in the past
CLCalendarFutureDayNumberTextColor;  //Day number text color for dates in the future
CLCalendarCurrentDayNumberTextColor; //Day number text color for today
CLCalendarSelectedDayNumberTextColor;    //Day number text color for the selected day
CLCalendarSelectedCurrentDayNumberTextColor; //Day number text color when today is selected
CLCalendarCurrentDayNumberBackgroundColor;   //Day number background color for today when not selected
CLCalendarSelectedDayNumberBackgroundColor;  //Day number background color for selected day
CLCalendarSelectedCurrentDayNumberBackgroundColor;   //Day number background color when today is selected
CLCalendarSelectedDatePrintFormat;   //Selected Date print format,  - Default: @"EEE, d MMM yyyy"
CLCalendarSelectedDatePrintColor;    //Selected Date print text color -Default: [UIColor whiteColor]
CLCalendarSelectedDatePrintFontSize; //Selected Date print font size - Default : 13.f
CLCalendarBackgroundImageColor;      //BackgroundImage color - Default : see applyCustomDefaults.

You need to use this method to apply your customisation:

self.calendarView.calendarAttributes = @{
       CLCalendarBackgroundImageColor : [UIColor lightBackgroundColor],
       
       //Unselected days in the past and future, colour of the text and background.
       CLCalendarPastDayNumberTextColor : [UIColor lightGrayColor],
       CLCalendarFutureDayNumberTextColor : [UIColor lightGrayColor],
       
       CLCalendarCurrentDayNumberTextColor : [UIColor lightGrayColor],
       CLCalendarCurrentDayNumberBackgroundColor : [UIColor clearColor],
       
       //Selected day (either today or non-today)
       CLCalendarSelectedDayNumberTextColor : [UIColor whiteColor],
       CLCalendarSelectedDayNumberBackgroundColor : [UIColor primaryColor],
       CLCalendarSelectedCurrentDayNumberTextColor : [UIColor whiteColor],
       CLCalendarSelectedCurrentDayNumberBackgroundColor : [UIColor primaryColor],
       
       //Day: e.g. Saturday, 1 Dec 2016
       CLCalendarDayTitleTextColor : [UIColor darkGrayColor],
       CLCalendarSelectedDatePrintColor : [UIColor darkGrayColor],
       };

Disabling Date Selections

If you call setEnabledDates: on CLWeeklyCalendarView, then it will make only the enabled dates to be selectable in the UI. This is useful if you only have content to show on particular days.

If you use this option, make sure to also set CLCalendarDisabledDayBackgroundColor or CLCalendarDisabledDayTextColor to indicate to the users that some dates aren't selectable.

clweeklycalendarview's People

Contributors

caesarli avatar clisuper avatar esusatyo avatar nobre84 avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

nobre84 gtrnoc

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.