PigHeroT / FSCalendar

A superiorly awesome iOS7+ calendar control, compatible with both Objective-C and Swift2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fscalendar

Travis Version Platform Swift2 compatible Carthage compatible License Join the chat at https://gitter.im/WenchaoD/FSCalendar

Screenshots

iPhone

fscalendar

iPad

fscalendar-ipad

Working with AutoLayout and Orientation

fscalendar-scope-orientation-autolayout

Installation

CocoaPods:

  • For iOS8+: ๐Ÿ‘
use_frameworks!
pod 'FSCalendar'
  • For iOS7+:
pod 'FSCalendar'
  • Alternatively to give it a test run, run the command:
pod try FSCalendar

Carthage:

  • For iOS8+
github "WenchaoD/FSCalendar"

Manually:

  • Drag all files under FSCalendar folder into your project. ๐Ÿ‘

Support IBInspectable / IBDesignable

Only the methods marked "๐Ÿ‘" support IBInspectable / IBDesignable feature. Have fun with Interface builder

Setup

Use Interface Builder

  1. Drag an UIView object to ViewController Scene
  2. Change the Custom Class to FSCalendar
  3. Link dataSource and delegate to the ViewController

fscalendar-ib

  1. Finally, you should implement FSCalendarDataSource and FSCalendarDelegate in ViewController.m

Or use code

@property (weak , nonatomic) FSCalendar *calendar;
// In loadView(Recommended) or viewDidLoad
FSCalendar *calendar = [[FSCalendar alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
calendar.dataSource = self;
calendar.delegate = self;
[self.view addSubview:calendar];
self.calendar = calendar;

Or swift

private weak var calendar: FSCalendar!
// In loadView or viewDidLoad
let calendar = FSCalendar(frame: CGRect(x: 0, y: 0, width: 320, height: 300))
calendar.dataSource = self
calendar.delegate = self
view.addSubview(calendar)
self.calendar = calendar

Hide placeholder dates

fscalendar-showsplaceholder

  1. Set calendar.showsPlaceholders = NO;
  2. Implement -calendar:boundingRectWillChange:animated:
// For autoLayout
- (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated
{
    _calendarHeightConstraint.constant = CGRectGetHeight(bounds);
    [self.view layoutIfNeeded];
}
// For manual layout
- (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated
{
    calendar.frame = (CGRect){calendar.frame.origin,bounds.size};
}

Roll with Interface Builder

fscalendar - ibdesignable

More Usage

If you like this repo

  • Star this repo.
  • Send your calendar screenshot or itunes link address here.

Support me via paypal

License

FSCalendar is available under the MIT license. See the LICENSE file for more info.

Contributions

Contact

  • Email: f33chobits@gmail.com

About

A superiorly awesome iOS7+ calendar control, compatible with both Objective-C and Swift2

License:MIT License


Languages

Language:Objective-C 97.9%Language:Swift 1.9%Language:Ruby 0.2%