Latest 1.2.9
Homepage https://github.com/iurichiba/SSMaterialCalendarPicker
License MIT
Platforms ios 7.1, requires ARC
Authors

Shoryuken Solutions Logo

SSMaterialCalendarPicker

A lightly-customizable calendar pop-up view for range selection inspired by Google’s Material Design Guidelines and apps.

Tested on iOS 7, iOS8 and iOS9. Supports ONLY portrait orientation, atm.

Version
License
Platform

Demo GIF

Demo
(in Portuguese, but the default language is English)

Installation

I recommend using CocoaPods! Just add this line to your Podfile:

pod 'SSMaterialCalendarPicker'

Usage

Usage is really simple!

  • Instantiate a SSMaterialCalendarPicker object on your View Controller:
// Add it on the keyWindow if you're using an UINavigationBar
datePicker = [SSMaterialCalendarPicker initCalendarOn:[UIApplication sharedApplication].keyWindow withDelegate:self];

// If there's a fullscreen view, add it there
datePicker = [SSMaterialCalendarPicker initCalendarOn:self.view withDelegate:self];
  • OPTIONAL – Customize it as you wish:
// Set a Locale if you want to force the localization - otherwise, it uses the device's default locale
datePicker.forceLocale = [NSLocale localeWithLocaleIdentifier:@"pt_BR"];

// Set a warning message for disabled intervals. Default is "WARNING: Interval unavailable!"
datePicker.disabledIntervalWarning = @"Anfitrião indisponível neste período!";

// Set a calendar title. Default is "Select an Interval"
datePicker.calendarTitle = @"Selecione um Período";

// Set apply button title. Default is "Apply"
// OBS: this is hidden on single date mode
datePicker.okButtonText = @"Aplicar";

// Set a primary and a secondary color
datePicker.primaryColor = [UIColor colorWithRed:255/255.0f green:87/255.0f blue:34/255.0f alpha:1.0f];
datePicker.secondaryColor = [UIColor colorWithRed:244/255.0f green:81/255.0f blue:30/255.0f alpha:1.0f];

// Set disabled dates. Dates previous to the current date are disabled by default.
datePicker.disabledDates = @[[NSDate daysFromNow:arc4random_uniform(300)], [NSDate daysFromNow:arc4random_uniform(300)]];

// Set single date mode as YES, if needed
datePicker.singleDateMode = YES;
  • Show the calendar:
[datePicker showAnimated];
  • Oh, and remember to implement the SSMaterialCalendarPickerDelegate protocol:
// .h code:
#import "SSMaterialCalendarPicker.h"
@interface ExampleViewController : UIViewController <SSMaterialCalendarPickerDelegate>

// .m code:
- (void)rangeSelectedWithStartDate:(NSDate *)startDate andEndDate:(NSDate *)endDate {
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setLocale:[NSLocale localeWithLocaleIdentifier:@"pt_BR"]];
    [formatter setDateFormat:@"EEEE, dd 'de' MMMM 'de' YYYY"];
    [self.startDateLabel setText:[NSString stringWithFormat:@"Entrada: %@", [formatter stringFromDate:startDate]]];
    [self.endDateLabel setText:[NSString stringWithFormat:@"Saída: %@", [formatter stringFromDate:endDate]]];
}

Contact & Feedback

If you have any feedbacks, doubts or you just want to yell at me for some reason, please send me an e-mail to [email protected]. Any help on this project is more than welcome!

And if you end up using this component, I’d love to hear about your app and check it out! 🐶

License

The MIT License

Copyright (c) 2015 Shoryuken Solutions ([email protected])

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.

Latest podspec

{
    "name": "SSMaterialCalendarPicker",
    "version": "1.2.9",
    "summary": "A lightly-customizable calendar pop-up view for range selection inspired by Google's Material Design Guidelines and apps.",
    "homepage": "https://github.com/iurichiba/SSMaterialCalendarPicker",
    "screenshots": [
        "http://i.imgur.com/h2kNho0.png",
        "http://i.imgur.com/30Eivbn.gif"
    ],
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": {
        "Iuri Chiba": "[email protected]"
    },
    "platforms": {
        "ios": "7.1"
    },
    "source": {
        "git": "https://github.com/iurichiba/SSMaterialCalendarPicker.git",
        "tag": "v1.2.9"
    },
    "source_files": [
        "SSMaterialCalendarPicker/Classes",
        "SSMaterialCalendarPicker/Classes/**/*.{h,m}"
    ],
    "exclude_files": "SSMaterialCalendarPicker/Classes/Exclude",
    "resource_bundles": {
        "CalendarViews": [
            "SSMaterialCalendarPicker/Classes/**/*.xib"
        ]
    },
    "requires_arc": true,
    "xcconfig": {
        "FRAMEWORK_SEARCH_PATHS": "$(PODS_ROOT)/../../Framework $(PODS_ROOT)/../External"
    }
}

Pin It on Pinterest

Share This