Giter VIP home page Giter VIP logo

calendar's Introduction

CalendarLib

Version License Platform

CalendarLib is a set of views and controllers for displaying and scheduling events on iOS.

Warning:

As some people may have noticed, this project has not got any update recently, and a lot of issues / pull requests remain unanswered. I’m very sorry for that, but I don’t have any time at the moment to take care of this repo, being very busy with other projects. I may come back to it in the future, but meanwhile, please don’t expect any update soon.

Thanks anyway to all the contributors!

Day Planner View Day Planner View Month Planner View Month Planner View Year Calendar View

Features

  • Create and schedule events with iCal-like views and controllers
  • 3 kinds of views are available (a day planner view, a month planner view and a year view)
  • Scroll infinitely through days / months, or restrict scrolling to a given date range
  • Restrict range of displayed hours in the day planner view
  • Page through weeks in the day planner view or months in the month planner view
  • Use a standard view for event cells or create your own custom views
  • Easily customize appearance and layout (date format, colors, fonts, size of headers, number of visible days...)
  • Create events by tap-and-hold on the view
  • Drag-and-drop events to another date or time
  • Scroll through days / months while dragging
  • Specialized controllers for EventKit data source but can easily work with any custom event provider
  • Background event loading for the EventKit controllers
  • Ability to show an activity indicator for days while events are loading
  • Restrict ability to create or move events to certain dates through datasource protocol methods
  • Zoom in/out the day planner view to increase or decrease the height of hour slots
  • Dim certain time ranges in the day planner view

Compatibility

iPad / iPhone with iOS 8 or higher.

Installation

CocoaPods

The best way is to use CocoaPods. Add the following line to your Podfile :

pod "CalendarLib"

The old way

If you don't want to use CocoaPods, you need to copy the content of the CalendarLib folder into your project, as well as the source of the two dependencies : OSCache and OrderedDictionary.

Getting started

  1. If you want to use EventKit as a data source, create an instance of MGCDayPlannerEKViewController or MGCMonthPlannerEKViewController, or subclass them for your own needs.

    Don't forget to add the following frameworks to the project:

    • EventKit.framework
    • EventKitUI.framework
  2. If you want to use another event provider, subclass one of MGCDayPlannerViewController or MGCMonthPlannerViewController and implement the data source protocol methods.

  3. If you want to use a custom event cell, subclass MGCEventView or MGCStandardEventView and register the class with the day / month planner view.

See the demo project to get an idea of how to use the library and check the documentation

License

CalendarLib is available under the MIT license. See the LICENSE file.

Change-log

A summary of each CalendarLib release can be found in the CHANGELOG.

calendar's People

Contributors

ebetabox avatar gklka avatar jumartin avatar patrickhelmedica 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calendar's Issues

Set start date?

Hi, I have events with date from July 7 to July 15, how to I set the start date for week view controller?
If i manually change dates to July 20 or above, I see them on the week view, but all earlier dates do not appear when I scroll to their date.

Please advise.

Thanks in advance.

Large event fonts on day view

I'm working on an app for older folks and love the calendar, but they can't see the words as the font is too small. I'm trying to figure out the best path for making the event cells larger so that I can adjust the font to a size they can more ably see. Would appreciate any pointers in the right direction....

Please Create a QuickStart Guide in the ReadMe

It'd be awesome to have a quick guide in the readme for fast and simple implementation rather than having to search through the example in an attempt to get just a quick simple implementation working!

I would like to display minutes between every hours slots

I am trying to modify the calendar view for displaying time slots with minutes label in between each hours slot like

00 : 00 -------------------------------------------------
:15
:30
:45
01 : 00 -------------------------------------------------

Like this on pinch the time slot what should i do for above mentioned scenario ?
can any one help me in this stuff ?

Thanks in advance.

Selecting Today Button Twice freezes the app

When you are in the week view of the app and select the today button twice the app will freeze up and you can no longer do anything on that view. If you switch to Month Year or day view the app works fine just on the week view

Refresh view

I'm trying to refresh the view based on changes to the calendar data by another app. I'm hooking the event store like so:

[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(refreshCalendar:)
                                             name:EKEventStoreChangedNotification
                                           object:[self.calMgr getEventStore]];

The problem is, I'm not sure how to refresh the view. I've tried various things but there doesn't seem to be 1 call that I can use to refresh the view controllers REGARDLESS of the view type I'm using at this point (Week, Month, Year).

Is there a call that will reload the data and views?

pods,OSCache and OrderedDictionary question

could not read data from '/Users/xxxx/Desktop/Calendar-master/Pods/Target Support Files/OSCache/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.
could not read data from '/Users/xxxx/Desktop/Calendar-master/Pods/Target Support Files/OrderedDictionary/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

Need Swift Version or a Swift Tutorial

Guys,, i need a swift version or a swift tutorial to use this calendar in my project since i am not an expert in objective C. Anyone have used this library in their swift project? if it is, i need help to implement this library in my project

app crashes when dragging

Hi, this is a wonderful calendar!
I found one issue: If I´m in the weekView (I only show one day) and long tap on an event and drag it, the app crashes if only a small part of the event is visible (the main part of the event is hidden under the top).
The crash occurs in

  • (NSArray_)fetchEventsFrom:(NSDate_)startDate to:(NSDate_)endDate calendars:(NSArray_)calendars
    {
    NSPredicate *predicate = [self.eventStore predicateForEventsWithStartDate:startDate endDate:endDate calendars:calendars];

of course startDate and endDate is nil

The problem comes from here:

  • (NSDate*)dateAtPoint:(CGPoint)point rounded:(BOOL)rounded
    {
    if (self.dayColumnsView.contentSize.width == 0) return nil;

    CGPoint ptDayColumnsView = [self convertPoint:point toView:self.dayColumnsView];

ptDayColumnsView has a negative y value so the function returns nil

Side-by-side Events not drawing as intended

Julien:

really nice library. I am having an issue where events that are side-by-side do an odd overlap.

  1. Image 1 - the event on the left overlaps with the one on the right. If I scroll from right-to-left, I can see that the appointment on the right creeps over to the next column (Image 2)

  2. Image 3 - If I rotate the device, it redraws, but there seems to be a space between the 2 events

  3. Image 4 - If I rotate back to portrait, the cells align properly

  4. If I scroll the events vertically out of view, and then scroll them back in, they end up drawing like in 'Image 1' again.

Any ideas why this would be happening? Nothing in your code is immediately obvious. Also, I have an iPhone demo running. I could give it to you and you can tweak it to your liking.

Many thanks

  • Ezat
    image 1

image 2

image 3

image 4

I'd like to change YearView and MonthView to scroll left or right.

Hello, Jumartin

Thank you for your project. Now I am building calendar app based on your repo in swift.
I want to scroll left and right for Month and Yearview, currently, your sample is only scrolling top-to bottom, bottom-top to view prev or next month & Year.

Please let me know what is your suggestion to change this code.

Cheers!

New scrollableTimeRangeForDate function taking long time to execute

Hello, Thanks for your great Calendar library. In the one of the latest release I notices that there is lag when moving between dates. Using profile I came to know that this function is taking long time to return answer. The old way use Date for the calculation while the new function use the Calendar to do the job. But the Calendar way involve many other time consuming tasks. Can you check please?

- (MGCDateRange*)scrollableTimeRangeForDate:(NSDate*)date

WeekView issue

I am developing calendar view control in swift. But it is not working with MGCDayPlannerEKViewController.

When i subclass my custom class with MGCDayPlannerEKViewController and with protocol WeekViewControllerDelegate as given in this example it give me error like

Property 'delegate' with type 'WeekViewControllerDelegate?' cannot override a property with type 'MGCDayPlannerEKViewControllerDelegate!' (aka 'ImplicitlyUnwrappedOptional<MGCDayPlannerEKViewControllerDelegate>')

Swift example

i am trying to use your lib in my swift app while building. Have you already ported it in swift or have some example of calling from swift app.

Overriding default action when long-press

Hi,

I'm new to this but your library looks very promising.
In your demo app, long-press invokes what I'm assuming is the popup of the default event view. Can we override this to something else? For the sake of an example, how can one override this to an NSLog presenting the new date?

Thanks

Endless Loops in MGCMonthPlannerView

Huge memory leaks and overhead CPU usage occurs when scrolling MGCMonthPlannerView. Not shure but looks like it's on MGCEventsRowView. Tried to change maxVisibleLinesForDaysInRange method like in the code below, but it solves a little part of this bug occurences

- (NSUInteger)maxVisibleLinesForDaysInRange:(NSRange)range
{
 NSUInteger count = 0;
 for (NSUInteger day = range.location; day < NSMaxRange(range); day++)
 {
  count = MAX(count, [self numberOfEventsForDayAtIndex:day]);
 }
 // if count > max, we have to keep one row to show "x more events"
    return count > self.maxVisibleLines ? (self.maxVisibleLines == 0 ? 0 : self.maxVisibleLines - 1) : count;
}

[bug] crashes in viewDidLoad, swift

Hello,

I subclassed :
class selectTime: MGCDayPlannerViewController,CalendarViewControllerDelegate, WeekViewControllerDelegate{

and it crashes every time I open this controller because of unwrapping optional object
fatal error: unexpectedly found nil while unwrapping an Optional value

and I trace the error and I found the line that causes this error:
self.calendarViewController = controller
this is implemented in viewDidLoad, i'm using swift, and here is how I created controller object:
let controller:CalendarViewController = controllerForView(type: .CalendarViewWeekType)

and how to implement didEndLongPress method
and if anybody has an example of this library written in swift, please share it with us ❤️

thanks

Crash from Endless Loop

I am getting an endless loop on some occasions. It looks something like the attached image in XCode.
screenshot_857

It looks like a loop in MGCDayPlannerView with these 3 methods:

  • (BOOL)recenterIfNeeded;
  • (void)scrollViewDidScroll:(UIScrollView*)scrollview;
  • (void)reloadCollectionViews;

I'm not exactly sure how to break the loop properly. Your input would be appreciated. :-)

grey row at the top of dayPlannerView

Hello, thanks for your library, it is very cool and quite easy to customize.
I have one problem. Is there any possibility to get rid of that grey row at the top of day planner View ?
screen shot 2016-08-11 at 18 44 14

Many thanks

cheers
Wojtek

Iphone Compatibility

Hello Julien,

Thanks for this awesome Calendar
Just wanted to ask you will there be update in your control for IPhone Compatibility??

Thanks
Milap

NSCalendarsUsageDescription

Have any of you have had any kind of issue when uploading a build using CalendarLib in the App Store?
I keep getting this message

This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an **NSCalendarsUsageDescription** key with a string value explaining to the user how the app uses this data.

I have already included the NSCalendarUsageDescription in the Info.plist and InfoPlist.strings but the app keeps getting rejected. If nobody else have this issue and it has nothing to do with the library, you can please close this issue. But I have tried anything and I got to consider maybe the library had something to do.

Carthage support

This library looks great and I'd like to integrate it in my project.

I know I can download it manually, but do you have any plans for making it Carthage compatible?

Assertion failure in MGCDateRange

Hello,

I try to populate a week PlannerView from a web service.

I have a crash in checkIfValid method. The assertion failed even if the dates I pass are in the right order. This is because the retained end date is actually the last end date I passed, whereas the retained start date is generated by the lib. Here's my log when I create the MGCDateRange :

period : 2016-10-12 12:00:00 +0000 - 2016-10-12 16:00:00 +0000
period : 2016-10-12 18:00:00 +0000 - 2016-10-12 20:00:00 +0000
period : 2016-10-09 07:00:00 +0000 - 2016-10-09 10:00:00 +0000
period : 2016-10-09 11:00:00 +0000 - 2016-10-09 12:00:00 +0000
period : 2016-10-12 12:00:00 +0000 - 2016-10-12 16:00:00 +0000

and the retained start / end dates when assertion failed :
_start : 2016-10-16 22:00:00 UTC
_end : 2016-10-12 16:00:00 UTC

I should precise that I restrict the visible days to 7, and I don't care of the real date. I just care of the weekday and time. The web service returnes me an Int for the weekday and a string for the time (HH:mm), so I generate my own dates based on these values and the current date ('NSDate()').
The view is bounded by the current week's start and the current week's end.

Is there a workaround to do in my case ?

Thanks

Settable colors

I would like to change the separator lines' color via some property from [UIColor greyColor].

This is also true for the event indicator dots in the headers.

pod CalendarLib pulls 1.0 by default still

Thanks so much for providing this great repo! I was wondering why I saw a difference between what was pulled into my project than what I saw in the repo, and noticed in my Podfile.lock that it downloaded 1.0, even though 2.0 is what is listed on cocoapods.org. I specified a specific commit, and that worked, but I don't like that as a long-term solution. Am I missing something?

Edit source of events

Hi,

Currently the demo app loads the calendar from the device itself, and I did not notice a method to change the data source on controller level. Is there a way to set our own events, for example by parsing a custom JSON array to an NSArray? (assuming the items comply to a specific structure)

Thanks for all this work.

Limiting day/week view start size

Hi Julien. First of all, thanks for your good work here, saved me lots of time.

I can't limit properly the starting hour of a MGCDayPlannerView. I want to limit the view so users can't scroll before 08.00 AM, for example. In my current app, really makes no sense that users plan activities between 00.00 and 08.00. I was trying to play with content offsets on scrolling views, with no luck. Can you kindly explain me (or, at least, orient me) about this matter?

Thanks in advance

Dimming time ranges

I would like to set some custom background color (for example light gray) for times outside a certain time range (like before 9 AM and after 6 PM, plus weekends). To be exact, we are using CalendarLib for displaying dentist's schedules. The doctors have a duty time, and I want to display this duty time by dimming their off-duty times slightly. They have different duty times for each day, so being able to dim ranges by individual days would be handy.

CocoaPod release?

Hello!

Our app is using your library, and you included a few additions recently (being able to set colors, restrict timeframe) which we really need before the release. I see that you are actively improving the library currently. When do you plan to release a new CocoaPod version which includes these changes? Shall I wait for it or just use a git source in my project?

not found file of

i download this demo

i build the project that time occur error is below

error: could not read data from '/Users/mypc/Downloads/Calendar-master-2/Pods/Target Support Files/OrderedDictionary/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

could not read data from '/Users/mypc/Downloads/Calendar-master-2/Pods/Target Support Files/OrderedDictionary/Info.plist': The file “Info.plist” couldn’t be opened because there is no such file.

Multi-day views issue on dayPlannerView

Hi,

I am trying to use viewForEventOfType: within my controller which extends from MGCDayPlannerViewController. I only use MGCTimedEventTypes and they work fine as long as they don't overlap days. If they overlap, all next days plus same day appear as all-day, see attachment.

I do set the range with dateRangeForEventOfType:, where I'm essentially returning [MGCDateRange dateRangeWithStart:event.beginDate end:event.endDate];

Last place I can imagine go wrong is the numberOfEventsOfType: method. Currently I use an NSDictionary<NSString *, NSArray *>, where the key is the format string of the begin date of the event (so no knowledge of overlapping) and the value is the array of events starting at that day.
What does this method expect exactly? if I have only one event from 1 July 13:00 to 3 July 19:00; does it mean that:
1 July returns 1
2 July returns 1
3 July returns 1
?

Thanks a lot

img_0136

Device Rotation Error

I am getting this error on device rotation when using single day display on iPhone.

'Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.'

I am not exactly sure how to fix it. I also got odd drawing artefacts on rotation animation - the displayed text in an eventView stretches out like it was written on silly-putty.

Also, the day column does not expand properly during animation (when going from portrait to landscape) so that it displays 2 columns instead of 1 column at the end of rotation.

Swift version

Hello!Your calendar is great!I ;m trying to convert it to Swift and a'i m having some trouble there.Will a Swift compatible version be available anytime soon?Or where should i start??Thank you in advance!

How to set an alpha or remove this gray bar that appears under the header?

I see in some of the screenshots on the repository that there is a transparent bar under the header, but when I add the calendar in my project there is always this gray bar that is not transparent. So I would like to know how to set an alpha on it, so I could actually put it to 0, if there is a way of removing it, even better.

See the screenshot with the bar:
screen shot 2016-10-20 at 12 45 41

And with alpha as showed in the repository page:
screen shot 2016-10-20 at 12 43 24

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.