Git Product home page Git Product logo

mbcalendarkit's Introduction

Promo

About

MBCalendarKit is a calendar control written in Objective-C with modern best practices and Swift interoperability in mind.

It offers a flexible calendar control, with support for displaying any calendar system supported by NSCalendar. It also includes an API to customize the calendar cells. It also ships with a prebuilt view controller, inspired by the original iOS calendar.

Carthage compatible Build Status

Features

  • Interactive Calendar Control
  • Autolayout Support
  • Dynamic Framework for iOS 8+
  • Custom Cell API with Default Implementation
  • Calendar Event Display
  • Custom First Weekday
  • Clamp Dates to Minimum and/or Maximum Values
  • Display for Any Locale or Calendar Identifier
  • Display Modes: Month, Week, and Day
  • Localization Support, Including Right-to-Left and Date Formatting
  • Pre-built View Controller inspired by the original iOS Calendar App
  • Sample App With Various Demo Implementations

Getting Started:

You'll need to target iOS 8+. There are three four ways to integrate MBCalendarKit:

  1. Cocoapods: pod 'MBCalendarKit', '~> 5.0.0'
  2. Carthage: github MosheBerman/MBCalendarKit ~> 5.2.0
  3. Drag this Xcode project in to your own, and add the framework as a dependency.
  4. If you really want to drag the raw source in, the framework code is in MBCalendarKit/CalendarKit.

If there are any problems, please head over to issue #48 and leave a comment.

Swift & Objective-C

MBCalendarKit is written in Objective-C. To use MBCalendarKit with Swift, just link against and use import MBCalendarKit. MBCalendarKit 5.0.0 includes a number of Swift enhancements.

The examples here are in Swift, for berevity. Note that when writing Objective-C, MBCalendarKit prefixes its classes and enums with CK. CalendarView in Swift is CKCalendarView in Objective-C, etc.

For specifics, check out the Migration Guide.

Features

Presenting a Calendar

You have two choices for showing a calendar using MBCalendarKit.

  1. You can show an instance of CKCalendarView. Use this if you want to manually manage your view hierarchy or just want a calendar view without the events table view.
/// Here's how you'd show a CalendarView from within a view controller.
/// Import the framework, then it's just three easy steps.

import MBCalendarKit
    	
// 1. Instantiate a CKCalendarView
let calendar = CalendarView()
 		
// 2. Present the calendar 
self.view.addSubview(calendar)

// 3. Add positioning constraints:
self.calendarView.translatesAutoresizingMaskIntoConstraints = false
calendarView.topAnchor.constraint(equalTo:self.topLayoutGuide.bottomAnchor).isActive = true
calendarView.centerXAnchor.constraint(equalTo:self.view.centerXAnchor).isActive = true
  1. Your second option is to create an instance of CalendarViewController. Using a CKCalendarViewController gives you the added benefit of a "today" button and a segmented control in the toolbar, which allows you to select the display mode. In MBCalendarKit 5.0.0 and later, you also use CalendarViewController if you'd like an events table view.
/// Here's how you'd show a CalendarViewController from 
/// within a view controller. It's just three easy steps, including the framework import.
		
// 1. Import MBCalendarKit:
import MBCalendarKit
    	
// 2. Instantiate a CalendarViewController
let calendar = CalendarViewController()
 		
// 3. Present the calendar 
self.present(calendar animated:true completion:nil)
		

With both CalenderView and CalendarViewController, you can use the dataSource and delegate properties to display events, and get information about user interation.


Note: In older versions of MBCalendarKit, CKCalendarViewController used to subclass UINavigationViewController, so it couldn't be installed inside of another navigation controller. In 5.0.0, this is no longer the case. If you wish to embed your calendar inside a UINavigationViewController, you must now install it on your own. See the Migration Guide for details.


In MBCalendarKit 5.0.0, there's a new property on CalendarView called customCellProvider, which can be used to customize the display of the cells in a really powerful way. Keep reading to learn more about setting up events

Showing Events

The CKCalendarDataSource protocol defines a method, which supplies an array of CKCalendarEvent objects. The calendar view automatically shows an indicator in cells that represent dates that have events.

func calendarView(_ calendarView: CalendarView, eventsFor date: Date) -> [CalendarEvent]

In your data source, implement this method and return the events matching the date being passed in.

Here's an example of adding a few events to the calendar:

func adEventsToCalendar() {
  let title : NSString = NSLocalizedString("Add Swift Demo", comment: "") as NSString
    if let date : Date = NSDate(day: 9, month: 1, year: 2015) as Date?
    {
      let event : CalendarEvent = CalendarEvent(title: title as String, andDate: date, andInfo: nil)
      self.data[date] = [event]
    } 

    let title2 : NSString = NSLocalizedString("Release MBCalendarKit 5.0.0", comment: "") as NSString
    if let date2 : Date = NSDate(day: 15, month: 8, year: 2017) as Date?
    {
      let event2 : CalendarEvent = CalendarEvent(title: title2 as String, andDate: date2, andInfo: nil)
      self.data[date2] = [event2]
    }
}

Now, implement the data source:

//  MARK: - CalendarDataSource

override func calendarView(_ calendarView: CalendarView, eventsFor date: Date) -> [CalendarEvent] 
{
    let eventsForDate = self.data[date] ?? []
 
    return eventsForDate
}

Note: The dates used as keys must match the dates passed into the data source method exactly. One way to ensure this is to use the NSCalendar's isDate:equalToDate:toUnitGranularity:, passing in the two dates and .day as the third argument, to create the dates you pass to your events.

You can also see this code in CKDemoViewController.m or SwiftDemoViewController.swift in the demo app.

Handling User Interaction

These methods, defined in the CalendarViewDelegate protocol, are called on the delegate when the used selects a date. A date is considered selected when either an arrow in the header is tapped, or when the user lifts their finger from a cell.

func calendarView(_ calendarView: CalendarView, willSelect date: Date) 
func calendarView(_ calendarView: CalendarView, didSelect date: Date) 

This method is called on the delegate when a row is selected in the events table. You can use to push a detail view, for example.

func calendarView(_ calendarView: CalendarView, didSelect event: CalendarEvent) 

Customizing Cells

MBCalendarKit 5.0.0 brings a brand new way to customize cells, so that you can add your own data to the cells, or even do a completely design. By building on top of UICollectionView, MBCalendarKit provides a really simple API. First, you need to implement CustomCellProviding in your code. This is composed of two parts: First, telling MBCalendarKit which UICollectionViewCell subclass to use for the cells, and second, implementing a method callback which will be your opportunity to customize the cell based on its context.

Let's look at an implementation based on the default implementation:

// Step 1. Formally adopt the `CustomCellProviding` protocol
Class MyCustomCellProvider: NSObject, CustomCellProviding {

    // Step 2. Inform the framework of your `UICollectionViewCell` subclass, so it knows to use it.
    var customCellClass: AnyClass
    {
        return CKCalendarCell.self
    }

    // Step 3. Implement the custom cell delegate callback
    func calendarView(_ calendarView: CalendarView, willDisplay cell: UICollectionViewCell, in context: CalendarCellContext) {

        // It's reasonable to cast to whatever class is in `customCellClass`.
        guard let cell = cell as? CustomCalendarCell else
        {
            return
        }

        // Customize the cell's contents and display here.
    }
}

Now, simply tell the calendar view that your object is providing custom cells:

// 0. Assume an existing calendarView

// 1. Instantiate your custom cell provider.
let myCustomCellProvider = MyCustomCellProviderClass()

// 2. Assign the custom cell provider to the calendar view's customCellProvider.
calendarView.customCellProvider = myCustomCellProvider

That's it. The demo app and the migration guide have more information.


Note: Prior to MBCalendarKit, customization of the cell's appearance was limited to properties accessible via UIAppearance. Those UIAppearance methods are still available in MBCalendarKit 5.0.0.


Calendar Cell Contexts:

If you want to know which date the cell represents, or what scope the cell is being displayed in, look at the context object. CKCalendarCellContext has a few interesting properties:

To see the date represented by the cell, use the date property.:

var date: Date

To see if the cell represents today, is out of the month, or even out of range of the calendar's minimum and maximum dates, use the context's identifier property, which is one of several CalendarCellContextIdentifier values.

var identifier: CKCalendarCellContextIdentifier

The context identifier is based on several other flags, also available on CalendarCellContext. Check out the CocoaDocs generated documentation, or the class header for more.

Calendar Events

CalendarEvent is a simple data structure class which holds a title, a date, and an info dictionary. The calendar view will display automatically display CalendarEvent objects as passed to it by its data sourcee. If you have custom information that you want to show in a detail view, you can attach it to the event's info property.

As of MBCalendarKit 2.1.0, there's a color property as well. Setting it will cause the cell to display a colored "tag" in the cell. This feature should be considered experimental for now.

Customizing the First Day of the Week:

Version 2.2.0 adds support for the firstWeekday property of NSCalendar. If the currentCalendar (or whichever you set) has some day other than Sunday set as the first day of the week, the calendar view will respect that.

/// Instantiate a CalendarViewController or CalendarView.
let calendarViewController = CKCalendarViewController()

/// Set the first day of the week to Monday.
calendarViewController.calendarView.firstWeekDay = 2

About the firstWeekDay property: Use integers 1-7 to set a weekday from Sunday through Saturday. NSCalendar doesn't say what happens if you use another number, so you're on your own if you do that.

Animating Week Transitions

As of MBCalendarKit 5.0.0, CalendarView has a animatesWeekTransitions property which can be turned on to enable animated transitions in week mode.


Addendum

Thanks

Dave DeLong, for being an invaluable reference. Thanks to the folks on the iOS Folks Slack team for guidance on nullability and input on working around floating point division precision.

Thank you to the various contributors for patches and reporting issues.

Want to Contribute?

Learn more about contributing by clicking here.

Code Of Conduct

MBCalendarKit adopts the Contributor Covenant Code of Conduct. Read it here.

License

MBCalendarKit is hereby released under the MIT License. See LICENSE for details.

Like This?

If you like MBCalendarKit, check out some of my other projects:

mbcalendarkit's People

Contributors

ahalls avatar andreirt avatar bhancock4 avatar mosheberman avatar takayoshimiyamoto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mbcalendarkit's Issues

App Crash When Going Back to Main View

I have a main view controller with a button that takes you to the calendar view. That and the calendar work just fine. The problem is when I try to go back to the main view from the calendar by tapping the back button on the navigation bar, the app crashes. The only message I get is "Thread 1: EXC_BAD_ACCESS(code=1, address=0xa000010)

Here is my code:

import "KFBCalendar.h"

import "NSDate+Components.h"

@interface KFBCalendar ()
@Property NSMutableDictionary* eventsDict;
@EnD

@implementation KFBCalendar

  • (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
    {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    // Custom initialization
    }
    return self;
    }

  • (void)viewDidLoad
    {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    CKCalendarView *calendar = [CKCalendarView new];

    [calendar setDelegate:self];
    [calendar setDataSource:self];

    [[self view]addSubview:calendar];

    NSDateFormatter *dateformatter = [[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:@"MM/dd/yyyy HH:mm"];

    // NSMutableDictionary* eventsDict = [[NSMutableDictionary alloc] init];
    _eventsDict = [[NSMutableDictionary alloc] init];
    NSMutableArray* eventsArray = [[NSMutableArray alloc] init];

    CKCalendarEvent* aCKCalendarEvent = [[CKCalendarEvent alloc] init];
    aCKCalendarEvent.date = [dateformatter dateFromString: @"12/04/2013 07:15"];
    aCKCalendarEvent.title = @"Annual Meeting";
    [eventsArray addObject: aCKCalendarEvent];
    [_eventsDict setObject: eventsArray forKey: [NSDate dateWithDay:04 month:12 year:2013]];

    eventsArray = [[NSMutableArray alloc] init];
    aCKCalendarEvent = [[CKCalendarEvent alloc] init];
    aCKCalendarEvent.date = [dateformatter dateFromString: @"12/05/2013 13:30"];
    aCKCalendarEvent.title = @"Annual Meeting";
    [eventsArray addObject: aCKCalendarEvent];
    [_eventsDict setObject: eventsArray forKey: [NSDate dateWithDay:05 month:12 year:2013]];

    eventsArray = [[NSMutableArray alloc] init];
    aCKCalendarEvent = [[CKCalendarEvent alloc] init];
    aCKCalendarEvent.date = [NSDate dateWithDay:6 month:12 year: 2013];
    aCKCalendarEvent.title = @"Annual Meeting";
    [eventsArray addObject: aCKCalendarEvent];
    [_eventsDict setObject:eventsArray forKey:aCKCalendarEvent.date];
    }

  • (NSArray *)calendarView:(CKCalendarView *)calendarView eventsForDate:(NSDate *)date
    {
    return [ self eventsDict][date];
    }

  • (void)didReceiveMemoryWarning
    {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    }

@EnD

Feature Request: Method to change the dot color

Can be part of CKCalendarDataSource.h:

- (UIColor *)calendarView:(CKCalendarView *)calendarView dotColorForDate:(NSDate *)date;

I'll try this (and maybe calendarView:labelColorForDate, and calendarView:backgroundColorForDate), I need to learn more ;) I'm just afraid the code will not be as clean...

reloadData problem

I have moved the UITableView property to the CKCalendarView header so I can access it and then added a UIRefreshControl:

_refreshControl = [[UIRefreshControl alloc] init];
[_refreshControl addTarget:self action:@selector(refresher) forControlEvents:UIControlEventValueChanged];
[_calendar.table addSubview:_refreshControl];

This is because I am using coredata together with AFNetworking and MagicalRecord to fetch my calendar events from a rest service.

This is working great except when I try to call reload, reloadAnimated or even the tables reloadData directly in the AFNetworking success block i get no reaction. The table refuses to update until I click another date. Any ideas how I can force the reload when the request if finished?

Allow calendar traversal without impacting selected date.

Per, @snadahalli, in my words:

If you tap on one of the arrows on the calendar, it shows another month, and changes the selected date to the first of the newly visible month.

This behavior should remain enabled by default, but an optional alternative is to allow users of the library to set a flag which would allow users of the calendar to traverse the months without changing the date.

Setting up an Event

I am having trouble figuring out how to set up an event. Can I please get some detailed instructions on how to do this.

Thanks.

Using IB to place a CKCalendarView on a view, init not called.

When a CKCalendarView is placed on a view with InterfaceBuilder. The view is initiated with the following when the view is loaded.
- (id)initWithCoder:(NSCoder *)inCoder

Need a common setup routine that is called from the various ways the view is initialized.

Events not showing in Week and Day modes when Today is pressed

Hi, I have created some events and a dot appears under the days with events in Month mode correctly and switching to Week and Day modes shows the events.

However, when I press Today, the Month mode still shows the dots but not in the Week and Day modes. (noted that there is no event on today's date)

After tapping on a day with an event in Moth mode, the events re-appear in Week and Day modes.

CalendarKit does not install correctly from 2.0.0 cocoapod

When using:
pod 'MBCalendarKit', '~>2.0.0'
Not all of the source files are included in the project.

Changed to:
pod 'MBCalendarKit', :git => 'https://github.com/MosheBerman/MBCalendarKit'
And that seems to work.

Looks like the source files are off in the podspec in trunk, looking in a Classes directory.

CocoaPods support

Thanks for providing the calendar kit, it looks really promising! I'd love to see MBCalendarKit supporting CocoaPods for easier integration!

Wrong date with didSelectDate

When selecting a date the didSelectDate:(NSDate *)date is displaying the the previous day. So selecting 2014-09-21 the console will log 2014-09-20.

calendar

This is what I am getting in the console

log

Is there a timezone setting or something I'm missing?

Cocoapod install is empty

Hi,

Here is my Podfile:

pod 'MBCalendarKit'

But the installed Pod is empty, containing only one header file:

capture d ecran 2014-01-24 14 49 27

Cell resized

Hi,

I'm trying to create a landscape view for the calendar, so I want to increase the width of cells. Even if I change the width from _cellSize method when in landscape
(- (CGSize)_cellSize
{
// These values must be hard coded in order for rectForDisplayMode: to work correctly

if( ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeLeft) || ([[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationLandscapeRight))
    return CGSizeMake(81, 44);

return CGSizeMake(46, 44);

}),

it shows up like that:
screen shot 2013-10-28 at 1 19 50 pm

What should I modify in order to get rid of those white spaces?

Thanks in advance!

CKCalendarView appearing behind iOS 7 status bar

This is a similar issue to having a UITableView on a UIView in iOS 7, where the UITableView starts too high and is behind the status bar. When I put a CKCalendarView on a UIView, the calendar starts behind the status bar, too. I can't seem to figure out a way of pushing it down by 64-pixels to be in the correct place. Is there something I'm missing?

CKCalendarView Issue

Custom Event table Cell

When I try to customize cell of CKCalenderView it does not change on device but it work on simulator why ?It should work on both simulator & iPhone as well

Forward/Back Arrows

The calendar title view has back/next buttons, but they're invisible. These guys need to be drawn out some way or another.

Resize header in landscape

Hi,

Thanks for this calendar, it is awesome and well documented.
However, i can't find a way to resize the header view when i rotate my device to landscape.
The Calendar View is well displayed but not the header.
How can I achieve this please ?

Thanks.

Helpful Suggestions

  • Prefix all classes, protocols and files to use the MBCalendarKit prefix (MB...)
  • The main import file should be <MBCalendarKit/MBCalendarKit.h>
  • In the read me on git, include a line near the top for easy copy/paste of CocoaPods use (for people who don't use CocoaPods.org)
  • Your first example might want to include stuff that looks good on iOS 7

That's all. Good work!

Monthly view doesn't show events until touch event.

I am loading an CKCalendarView in my view controller, and the calendar presents and the dots are added to each day that there is event(s) for that date. Now, if there are events for the given day, the events table shows "No Events Today" until the current day is touched.

Connecting CKCalendarDataSource to Core Data array

Could you please provide some sample code for the method:

- (NSArray *)calendarView:(CKCalendarView *)calendarView eventsForDate:(NSDate *)date;

This is the code I'm implementing:

for (Task *task in _taskArray)
{
    _event = [CKCalendarEvent eventWithTitle:[task valueForKey:@"title"] andDate:[task valueForKey:@"startDate"] andInfo:nil];
    [_eventsArray addObject:_event];
}
[_calendarData setObject:_eventsArray forKey:_event.date];
- (NSArray *)calendarView:(CKCalendarView *)calendarView eventsForDate:(NSDate *)date {
   return _calendarData[_event.date];
}

But the outcome is not the desired one, as I get all the events in the array everyday in the calendar.

screen

Cell Panels - Animation

As it is now, switching months has a funky cell animation. This can be fixed by wrapping cells in a panel and animating the panel into position.

Build error

clang: error: no such file or directory: '/Users/aaron/Downloads/MBCalendarKit-master/MBCalendarKit/CKDemoViewController.m'
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

Can't advance to February when Jan 29 or 30 is selected.

In CKCalendarView, if Jan 29th or 30th is selected and you tap the forward button, you do not advance to February. Instead, Jan 30th is selected.

The problem is this calculation in forwardTapped:

    //  Otherwise, add a month and then go to the first of the month
    else{
        NSUInteger day = [[self calendar] daysInDate:date];
        date = [[self calendar] dateByAddingMonths:1 toDate:date];              //  Add a month
        date = [[self calendar] dateBySubtractingDays:day-1 fromDate:date];     //  Go to the first of the month
    }

Drop shadows and bevels

The view is rather flat at the moment. This can be improved with a dash of Core Graphics.

Date comparison methods are reversed

In

MBCalendarKit / MBCalendarKit / CalendarKit / Categories / Foundation / NSCalendar / NSCalendar+Ranges.m

Utility Methods isBeforeDate and isAfterDate are reversed which causes a bug for using a minimum and maximum date range.

pragma mark - Date Comparison

  • (BOOL)date:(NSDate *)firstDate isBeforeDate:(NSDate *)anotherDate
    {
    if (!firstDate || !anotherDate)
    {
    return NO;
    }

    //return [self secondsFromDate:firstDate toDate:anotherDate] < 0;
    return [self secondsFromDate:firstDate toDate:anotherDate] > 0;
    }

  • (BOOL)date:(NSDate *)firstDate isAfterDate:(NSDate *)anotherDate
    {
    if (!firstDate || !anotherDate)
    {
    return NO;
    }

    //return [self secondsFromDate:firstDate toDate:anotherDate] > 0;
    return [self secondsFromDate:firstDate toDate:anotherDate] < 0;
    }

Regarding detail of event

Hello,
how can i custom table row(cell) layout for the calendar event for particular/All date.
I tried in CKCalendarCiew.m in cellForRowatIndex methoed llike

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    NSUInteger count = [[self events] count];
    [tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

    if (count == 0) {
    UITableViewCell *cell = [[self table] dequeueReusableCellWithIdentifier:@"noDataCell"];
    [[cell textLabel] setTextAlignment:NSTextAlignmentCenter];
    [[cell textLabel] setTextColor:[UIColor whiteColor]];
    [[cell textLabel] setFont:[UIFont fontWithName:FONT_BOLD1 size:22]];

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [cell.contentView setBackgroundColor:[UIColor colorWithRed: 214.0/255.0 green: 214.0/255.0 blue: 214.0/255.0 alpha: 1.0]];
    
    UIImageView* img =[[UIImageView alloc] init];
    [img setFrame:CGRectMake(0, 56, 320, 4)];
    [img setImage:[UIImage imageNamed:@"saprator_iPhone.png"]];
    [cell addSubview:img];
    
    cell.accessoryView=nil;
    
    if ([indexPath row] == 1) {
        [[cell textLabel] setText:NSLocalizedString(@"No Events", @"A label for a table with no events.")];
    }
    else
    {
        [[cell textLabel] setText:@""];
    }
    return cell;
    

    }

    UITableViewCell cell = [[self table] dequeueReusableCellWithIdentifier:@"cell1"];
    if (cell==nil) {
    cell=[(UITableViewCell
    )[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell1"];

    UILabel *lblBillerName=[[UILabel alloc] initWithFrame:CGRectMake(5, 2, 300, 20)];
    lblBillerName.tag=1;
    [lblBillerName setBackgroundColor:[UIColor clearColor]];
    [lblBillerName setTextColor:[UIColor colorWithRed: 109.0/255.0 green: 173.0/255.0 blue: 63.0/255.0 alpha: 1.0]];
    [lblBillerName setFont:[UIFont fontWithName:FONT_BOLD1 size:16]];
    [lblBillerName setTextAlignment:NSTextAlignmentCenter];
    [cell.contentView addSubview:lblBillerName];
    
    
    
    UILabel *lblAccNumberHead=[[UILabel alloc] initWithFrame:CGRectMake(5,23, 48, 18)];//a/c no.
    [lblAccNumberHead setText:@"a/c no. :"];
    [lblAccNumberHead setBackgroundColor:[UIColor clearColor]];
    [lblAccNumberHead setTextColor:[UIColor colorWithRed: 51.0/255.0 green: 51.0/255.0 blue: 51.0/255.0 alpha: 1.0]];
    [lblAccNumberHead setFont:[UIFont fontWithName:FONT_REGULAR1 size:10]];
    [cell.contentView addSubview:lblAccNumberHead];
    
    UILabel *lblAccNumber=[[UILabel alloc] initWithFrame:CGRectMake(61,23, 226, 18)];
    lblAccNumber.tag=2;
    [lblAccNumber setTextColor:[UIColor colorWithRed: 51.0/255.0 green: 51.0/255.0 blue: 51.0/255.0 alpha: 1.0]];
    [lblAccNumber setBackgroundColor:[UIColor clearColor]];
    [lblAccNumber setFont:[UIFont fontWithName:FONT_BOLD1 size:12]];
    [cell.contentView addSubview:lblAccNumber];
    
    
    UILabel *lblLastMonthBillHead=[[UILabel alloc] initWithFrame:CGRectMake(5,39, 60, 18)];//Last  month Bill
    [lblLastMonthBillHead setText:@"Last month bill"];
    [lblLastMonthBillHead setBackgroundColor:[UIColor clearColor]];
    [lblLastMonthBillHead setTextColor:[UIColor colorWithRed: 51.0/255.0 green: 51.0/255.0 blue: 51.0/255.0 alpha: 1.0]];
    [lblLastMonthBillHead setFont:[UIFont fontWithName:FONT_REGULAR1 size:10]];
    [cell.contentView addSubview:lblLastMonthBillHead];
    
    UILabel *lblLastMonthBill=[[UILabel alloc] initWithFrame:CGRectMake(76, 39, 70, 18)];
    lblLastMonthBill.tag=3;
    [lblLastMonthBill setBackgroundColor:[UIColor clearColor]];
    [lblLastMonthBill setTextColor:[UIColor colorWithRed: 51.0/255.0 green: 51.0/255.0 blue: 51.0/255.0 alpha: 1.0]];
    [lblLastMonthBill setFont:[UIFont fontWithName:FONT_BOLD1 size:12]];
    [cell.contentView addSubview:lblLastMonthBill];
    
    UIImageView* imgLine =[[UIImageView alloc] init];
    [imgLine setFrame:CGRectMake(158, 38, 2, 18)];
    [imgLine setBackgroundColor:[UIColor colorWithRed: 109.0/255.0 green: 173.0/255.0 blue: 63.0/255.0 alpha: 1.0]];
    [cell addSubview:imgLine];
    
    
    UILabel *lblTotalDueAmountHead=[[UILabel alloc] initWithFrame:CGRectMake(163,39, 40, 18)];//Total  month Bill
    [lblTotalDueAmountHead setText:@"Total :"];
     [lblTotalDueAmountHead setBackgroundColor:[UIColor clearColor]];
    [lblTotalDueAmountHead setTextColor:[UIColor colorWithRed: 51.0/255.0 green: 51.0/255.0 blue: 51.0/255.0 alpha: 1.0]];
    [lblTotalDueAmountHead setFont:[UIFont fontWithName:FONT_REGULAR1 size:10]];
    [cell.contentView addSubview:lblTotalDueAmountHead];
    
    UILabel *lblTotalDueAmount=[[UILabel alloc] initWithFrame:CGRectMake(205, 39, 84, 18)];
    lblTotalDueAmount.tag=4;
    [lblTotalDueAmount setBackgroundColor:[UIColor clearColor]];
    [lblTotalDueAmount setTextColor:[UIColor colorWithRed: 51.0/255.0 green: 51.0/255.0 blue: 51.0/255.0 alpha: 1.0]];
    [lblTotalDueAmount setFont:[UIFont fontWithName:FONT_BOLD1 size:12]];
    [cell.contentView addSubview:lblTotalDueAmount];
    
    
    
    UIImageView* img =[[UIImageView alloc] init];
    [img setFrame:CGRectMake(0, 56, 320, 4)];
    [img setImage:[UIImage imageNamed:@"saprator_iPhone.png"]];
    [cell addSubview:img];
    
    UIImageView* imgAerrow =[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"aerrowClicked.png"]];
    cell.accessoryView=imgAerrow;
    [cell setBackgroundColor:[UIColor colorWithRed: 214.0/255.0 green: 214.0/255.0 blue: 214.0/255.0 alpha: 1.0]];
    [cell.contentView setBackgroundColor:[UIColor colorWithRed: 214.0/255.0 green: 214.0/255.0 blue: 214.0/255.0 alpha: 1.0]];
    

    }
    UILabel lblBillerName=(UILabel)[cell.contentView viewWithTag:1];
    UILabel lblAccNumber=(UILabel)[cell.contentView viewWithTag:2];
    UILabel lblLastMonthBill=(UILabel)[cell.contentView viewWithTag:3];
    UILabel lblTotalDueAmount=(UILabel)[cell.contentView viewWithTag:4];

    CKCalendarEvent *event = [[self events] objectAtIndex:[indexPath row]];

    [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];

    NSDictionary *dictInfo=event.info;
    NSLog(@"%@",dictInfo);
    lblBillerName.text=[event title];
    lblAccNumber.text=[[[dictInfo valueForKey:@"account"] valueForKey:@"id"] valueForKey:@"acctNo"];

    lblTotalDueAmount.text=[NSString stringWithFormat:@"%.2f",[[dictInfo valueForKey:@"totalAmt"] floatValue]];

    lblLastMonthBill.text=[NSString stringWithFormat:@"%.2f",[[dictInfo valueForKey:@"curAmt"] floatValue]];//[dictInfo valueForKey:@"dueDate"];

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    return cell;
    }

But its no working on device only working in simulators.
Thanks,

Request for delegate - `(void)calendarView:(CKCalendarView *)CalendarView eventsDidLoad;`

In some cases with lot of events, it's taking almost 45 seconds after selecting a date before the events for that date show. This is a problem, as the last date's events are still in the table...

So, after the user selects a date, I create a progress indicator and start it spinning using - (void)calendarView:(CKCalendarView *)CalendarView didSelectDate:(NSDate *)date; I would like to remove the spinner when the events list is finished populating. Maybe a delegate called (void)calendarView:(CKCalendarView *)CalendarView eventsDidLoad; ?

Is there already a hook someplace for this?

Not able to feach native calendar event

i am not able to fetch native calendar event.
it is possible to color or any image on date according to my event?
i want to mark my event on calendar.
how can i mark event this calender view?

Please Help me for sort out this thing.

Today Button

The main view controller should have some sort of "Today" button, which shows today.

Performance issues

I believe the calendar takes up a lot of resources and I find it slow.

Delegate Extension

The main view controller should have some sort of delegate extension so that we can pass it event objects.

Customizing Colors

Hi @MosheBerman, thanks for the great calendar control. What would you recommend as the best practices to change the colors of the calendar control? Should we just update the .h files with the color constants? Thanks.

[__NSCFCalendar dateByAddingComponents:toDate:options:]: date cannot be nil plaint, then further violations will simply silently do whatever random thing results from the nil.

2014-02-07 16:24:07.435 YoJo[11443:70b] *** -[__NSCFCalendar dateByAddingComponents:toDate:options:]: date cannot be nil
I mean really, what do you think that operation is supposed to mean with a nil date?
An exception has been avoided for now.
A few of these errors are going to be reported with this complaint, then further violations will simply silently do whatever random thing results from the nil.

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.