Coder Social home page Coder Social logo

pdtsimplecalendar's Introduction

PDTSimpleCalendar

Pod version Carthage compatible Build Status

PDTSimpleCalendar is a very simple calendar/date picker component for your iOS apps based on UICollectionView.

Default Scrolling Hebrew

###Upgrade Note

You should read the Release Notes when you upgrade to a newer version.

##Install

###Cocoapods

in your Podfile just add:

pod 'PDTSimpleCalendar', '~> 0.9.1'

then run pod install

And finally in your project import #import <PDTSimpleCalendar/PDTSimpleCalendar.h>

###Carthage

In your Cartfile simply add:

github "jivesoftware/PDTSimpleCalendar" ~> 0.9.1

run carthage update

Finally you need to add the built framework to your project. For more information about Carthage : github.com/Carthage/Carthage

Warning: Carthage uses dynamic framework and will only work if your app targets iOS 8.0 or later.

###Old-School If you don't like cocoapods or Carthage or Cocoapods-Rome, you can still import it using git submodule or simply copy/paste all the source files in PDTSimpleCalendar to your project.

##Customize it

###Calendar

  • firstDate : When the calendar must starts. If you don't specify anything, it will default to the first day of the current month (based on [NSDate date]). If firstDate is not the 1st of the month, the calendar will display the full month, but dates < firstDate will be disabled.
  • lastDate : When the calendar must ends. If you don't specify anything, it will default to the last day of the next year (based on firstDate). If lastDate is not the last day of the month, the calendar will display the full month, but dates > lastDate will be disabled.
  • calendar : Which calendar to use for display and date calculations. You can set any calendar supported by NSCalendar. the default value will be [NSCalendar currentCalendar].
  • weekdayHeaderEnabled: If enabled, add an extra header on top of the calendar with the days of the week. Default is NO.
  • weekdayTextType: If weekday header is enabled, you can customize the format of the label. (Short (3 letters), VeryShort (1 letter), StandAlone (Full name of the day))

###Colors You can change the display of the calendar using backgroundColor & overlayTextColor properties on PDTSimpleCalendarViewController.

Other colors can be set using UIAppearance on PDTSimpleCalendarViewCell, PDTSimpleCalendarViewHeader & PDTSimpleCalendarViewWeekdayHeader

[[PDTSimpleCalendarViewCell appearance] setCircleDefaultColor:[UIColor whiteColor]];
[[PDTSimpleCalendarViewCell appearance] setCircleSelectedColor:[UIColor orangeColor]];
[[PDTSimpleCalendarViewCell appearance] setCircleTodayColor:[UIColor blueColor]];
[[PDTSimpleCalendarViewCell appearance] setTextDefaultColor:[UIColor redColor]];
[[PDTSimpleCalendarViewCell appearance] setTextSelectedColor:[UIColor purpleColor]];
[[PDTSimpleCalendarViewCell appearance] setTextTodayColor:[UIColor magentaColor]];
[[PDTSimpleCalendarViewCell appearance] setTextDisabledColor:[UIColor yellowColor]];

[[PDTSimpleCalendarViewHeader appearance] setTextColor:[UIColor redColor]];
[[PDTSimpleCalendarViewHeader appearance] setSeparatorColor:[UIColor orangeColor]];

[[PDTSimpleCalendarViewWeekdayHeader appearance] setHeaderBackgroundColor:[UIColor lightGrayColor]];
[[PDTSimpleCalendarViewWeekdayHeader appearance] setTextColor:[UIColor orangeColor]];

See the Demo for the full API and even more customization.

Here is how it looks in the Producteev app:

Producteev

##License

Copyright 2013-2015 Jive Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

pdtsimplecalendar's People

Contributors

adonoho avatar archfear avatar hout avatar ianhoar avatar jmig avatar lancep avatar mikeabdullah avatar teonivalois avatar tewha avatar yuwen-yan 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  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

pdtsimplecalendar's Issues

When using the view controller with a custom timezone the calendar gets messed up

I'm using the PDTSimpleCalendarViewController in the following way (in Swift):

var vc = PDTSimpleCalendarViewController()
var calendar = NSCalendar(calendarIdentifier: NSGregorianCalendar)!
calendar.locale = NSLocale.currentLocale()
calendar.timeZone = NSDate.localTimeZone()
vc.calendar = calendar

NSDate.localTimeZone() is an custom function (an extension). This function gives the original default time zone (from when the app starts up, Europe/Amsterdam in my case), during the rest of the app the default time zone will be UTC.

When using this code the following incorrect calendar is produced: (note, I made this printscreen on the 5th, not the 4th)
s5egqecwchftlvnpf1voe8ueixg0q6whhdxgmwl_kee

Is there a way to solve this? (An other solution can be to support to overwrite the 'today' date)

Cannot see the Title and days label are over status bar

Hey! I implemented the calendar but I have some problems to have a correct render with the header. I can't see the title I set and also the day labels are over the status bar.
slack for ios upload-4 png

PDTSimpleCalendarViewController *calendarViewController = [[PDTSimpleCalendarViewController alloc] init];

[calendarViewController setDelegate:self];
calendarViewController.weekdayHeaderEnabled = YES;
calendarViewController.weekdayTextType = PDTSimpleCalendarViewWeekdayTextTypeShort;
[calendarViewController setTitle:@"SimpleCalendar"];
if ([UIViewController instancesRespondToSelector:@selector(edgesForExtendedLayout)]) {
    [calendarViewController setEdgesForExtendedLayout:UIRectEdgeNone];
}

[self presentViewController:calendarViewController animated:YES completion:nil];

Hiding cells that contain no data

Trying to fix an issue with using your framework.
We would like to set the background color of cells that have no valid date but I've not been able to hide those collection view cells.

img_0002

both scrollToDate: scrollToSelectedDate cause crashes

So a number of issues here:
scrollToDate doesnt work.
scrollToSelectedDate scrolls to the selectedDate which is works ok.
However, if any of these methods were called and you select another date it crashes.
On the other hand if none of the scroll methods are call it works ok. but i need to scroll to a certain date.

I'm not sure if i'm missing something or doing something wrong. But can you help me resolve this issue?
here is a screen shot of the log:
screen shot 2014-09-17 at 2 27 55 pm

Custom calendar view cell size.

I'm subclassing PDTSimpleCalendarViewController so that I can use a custom cell size.
Which works fine:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    CGFloat itemWidth = floorf(CGRectGetWidth(self.collectionView.bounds) / self.daysPerWeek);
    return CGSizeMake(itemWidth, 35.0);
}

However this causes issues when scrolling to date: scrollToDate:
Since the y origin in calculated:
origin.y -= (PDTSimpleCalendarFlowLayoutHeaderHeight + PDTSimpleCalendarFlowLayoutInsetTop + self.collectionView.contentInset.top);

Test code

Test code needed to test that current functionality is unbroken.

How could I set different background colour for different date cell?

I try to set circleDefaultColor property of PDTSimpleCalendarViewCell in - (void)setDate:(NSDate *)date calendar:(NSCalendar *)calendar method based on date is nil or not. However the display of cell's background colour is messed up. Where could I change the background circle colour of the cell based on different cases?

Unwind Segue

hi all,

I have implemented PDTSimpleCalender in Swift. I am happy with the results. My last step is getting the calender to "unwind" when a user selects a date.

My unwind segues work beautifully throughout my app. I double-checked with UIViewControllers and all worked great. But every time I try with my PDT class (which is a Collection View Controller) I get "can't find ID". Am I stumbling into an inheritance problem?

import UIKit

class customPDTCollectionViewController: PDTSimpleCalendarViewController,
PDTSimpleCalendarViewDelegate {

override func viewDidLoad() {
    super.viewDidLoad()

    // initialize my calender
    self.delegate = self
    self.firstDate = NSDate()
    self.calendar = NSCalendar.currentCalendar()
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, didSelectDate date: NSDate!) {
    println("date selected is \(date) ")
//   self.performSegueWithIdentifier("unwindID", sender: self)

}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, shouldUseCustomColorsForDate date: NSDate!) -> Bool {
    return true
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, circleColorForDate date: NSDate!) -> UIColor! {
    return UIColor(red: 0/255, green: 181/255, blue: 229/255, alpha: 1.0)
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, textColorForDate date: NSDate!) -> UIColor! {
    return UIColor.whiteColor()
}

}

Reverse calendar display

Add parameter for reverse days displaying.
For example from top to bottom:
March 2014
Ferbruary 2014
January 2014
December 2013
...

Jerk in Opening calendar in ModalView

I am using this library in my app. My requirement is to open the app in Modal view with a button click. and the calendar will show only 296 days from current date. and scroll the calendar on load to the ant selected date from those 296 days.
But i am facing a visible jerk in loading.

Deprecation warnings

I like my app to compile cleanly; the sheer number of deprecation warnings in PDTSimpleCalendarViewController.m (where it calls its own delegate) is frustrating to me.

Are these close to being removed, or are you interested in a patch that lets PDTSimpleCalendarViewController.m compile cleanly? (switching self.delegate to (id)self.delegate is enough)

Date Range Issue

Hi, i found out a bug with date ranges.
I first set a range for my calendar and all goes fine.
Than, when I set again the firstDate or lastDate, if the new firstDate falls in the previous month, when I select again a date it crashes with this log message:

*** Assertion failure in -[UICollectionView _endItemAnimations], /SourceCache/UIKit/UIKit-3318.93/UICollectionView.m:3901
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of sections. The number of sections contained in the collection view after the update (13) must be equal to the number of sections contained in the collection view before the update (12), plus or minus the number of sections inserted or deleted (0 inserted, 0 deleted).'

Is it me missing something or could you fix this?
I've tried even in your Demo app by setting a new startDate when a date is selected and the same behavior is happening.
Thank you in advance for the help, I'm here for more informations.

Style month titleLabel

Missing a feature to style the month label in the top left corner like setting textAlignment and font

Problem with init

All init methods call [super initWithCollectionViewLayout:...]
This is a big problem. When the view is loaded from Storyboard, "initWithCoder" is called and must call "[super initWithCoder]". The way it is done now, the view controller loses necessary information to build the layout.

BacgroundColor and cells with no date

When loading a cell with no date, the cell used a background color (white by default). I think it should be clearColor at least, or leave the choice to the user:

- (void)setDate:(NSDate *)date calendar:(NSCalendar *)calendar
{
    NSString* day = @"";
    if (date && calendar) {
        _date = date;
         day = [PDTSimpleCalendarViewCell formatDate:date withCalendar:calendar];
    }
    if ([day isEqualToString:@""])
    {
        [self setCircleColor:[UIColor clearColor] selected:NO];
    }
    self.dayLabel.text = day;
}

We can't use a background color for the component too. I'd like to use a clearBackground to show a blur picture underneath, but no matter what I do, the background is black.

Not support iOS7

I want to add the canlendar view as a subview in iOS7:


PDTSimpleCalendarViewController *vc = [[PDTSimpleCalendarViewController alloc] init];
    vc.firstDate = [NSDate date];
    NSDateComponents *offsetComponents = [[NSDateComponents alloc] init];
    offsetComponents.month = 3;
    NSDate *lastDate =[vc.calendar dateByAddingComponents:offsetComponents toDate:[NSDate date] options:0];
    vc.lastDate = lastDate;
[self addChildViewController:vc];
    [self.view addSubview:vc.view];
    [vc didMoveToParentViewController:self];


It has long time no responding.
I also try to present, like:


    [self presentViewController:vc animated:YES completion:^{
        
    }];

It also has long time no responding.
How can use it in iOS7 correctly?

Testing with Xcode6.4 Simulater5s 7.1

didSelectDate returns one day less

Hi.
when i select a date from calendar, didSelectDate method returns on day less. For example, if a i select 18-03-2105, didSelectDate returns 17-03-2015

Why?

Thankyou

Issue with Segue when using the PTDSimpleCalendarViewController

Basically the segue doesn't work. It says it couldn't find that Segue for this view controller. I have tried the same exact code for viewcontroller and the segue is found. The only difference is when I inherit from PTDSimpleCalendarViewController the segue is not found. If there is another way to do this please advise. Basically when a date is clicked I'd like to perform a segue.

//
// Calendar.h
// SuperMe
//
// Created by Saviz Artang on 9/18/15.
// Copyright (c) 2015 com.artangco. All rights reserved.
//

import "PDTSimpleCalendarViewController.h"

@interface CalendarViewController : PDTSimpleCalendarViewController

@Property (nonatomic, strong) NSDate * myselectedDate;

@EnD

//
// Calendar.m
// SuperMe
//
// Created by Saviz Artang on 9/18/15.
// Copyright (c) 2015 com.artangco. All rights reserved.
//

import "CalendarViewController.h"

import "SMTableViewController.h"

@implementation CalendarViewController

-(void) viewDidLoad
{
[super viewDidLoad];

self.delegate = self;

}

  • (void)simpleCalendarViewController:(PDTSimpleCalendarViewController *)controller didSelectDate:(NSDate *) date
    {
    self.myselectedDate = date;
    [self performSegueWithIdentifier:@"ctv" sender:self];
    }

  • (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {

    SMTableViewController * trackingTableView ;

    trackingTableView = [segue destinationViewController];
    trackingTableView.day = self.myselectedDate;
    }

@EnD

Selecting Custom Dates

Hi, not sure this is an issue but I'm unable to set custom dates I want selected.

// Fetch dates from core data and add them to an array

NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Bill"];
                                                             request.resultType = NSDictionaryResultType;
                                                             [request setPropertiesToFetch:[NSArray arrayWithObjects:@"billDueDate", nil]];
NSError *error = nil;
Self.fetchedDates = [self.managedObjectContext executeFetchRequest:request
                                                                                                                         error:&error];

How can I pass this array so the dates in them are selected in the method;

- (BOOL)simpleCalendarViewController:(PDTSimpleCalendarViewController *)controller shouldUseCustomColorsForDate:(NSDate *)date
{
    if ([_customDates containsObject:date]) {
        return YES;
    }

    return NO;
}

Preload month data by delegate

It would be a very usefull functionality to know which months are (about to be) visible. This way I can load data for the day cells. It would be usefull to have delegate functions like:

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, monthCanAppear date: NSDate!)
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, monthDidAppear date: NSDate!)
func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, monthDidDisappear date: NSDate!)

Here date would be the first of the month. Two ints (year and month) could work aswell.

A setting could determine how many months 'can appear' when scrolling (for example preload 2 months who are not in visible yet).

This way I can preload additional data about the dates in that month (in my case availibility information for a reservation system).

I can imagine other people would like this feature aswell.

Size Calendar

Hi.
I want to know if is possible to define the size of the calendar.

I want to put the current month for example in a part of the screen.

Thank You

Bad Layout when setting selectedDate

Hi,

I am trying to use the component but are having some difficulties with the selected date. Wondering if someone can point me in the right direction, or show me what I am doing wrong. The issue is that when I initialize I want to set the selected date, but when I do the calendar is all wrong, see screenshot. When I just set the first and last dates it is fine but obviously no date has been selected. So wondering what I am doing wrong when I try to set the selected date on startup.

This is the basic code that I am using and not sure if there is something I am doing wrong here, so any help would be appreciated.

PDTSimpleCalendarViewController *calendarController = [[PDTSimpleCalendarViewController alloc] init];
        [self.calendarDelegate setValidDates:validDates];

        [calendarController setDelegate:self.calendarDelegate];

        if (validDates != nil) {
            [calendarController setLastDate:validDates[0]]; //[NSDate date]];
            [calendarController setFirstDate:validDates[validDates.count-1]];   // The last date in the list of valid dates is the first date for the calendar.
        }
        //This causes the weird graphical issue
        [calendarController setSelectedDate:[dataSource reportAsOfDate]];
//        [calendarController scrollToSelectedDate:NO];
        self.calendarPopover = [[UIPopoverController alloc] initWithContentViewController:calendarController];
        [self.calendarDelegate parentPopover:self.calendarPopover];

Thank You

image

Wired weekday header position and height after subclassed PDTSimpleCalendarViewController

I subclassed PDTSimpleCalendarViewController and presented it as the root controller of an UINavigationController

The first issue I met is I called self.navigationController in - (void)viewDidLoad and it always returns nil and I have to change the navigationBar color in the - (void)viewWillAppear: instead.
This is not the big problem.

Then I want it to display the weekday header.
I set the controller.weekdayHeaderEnabled = YES
As a result, the view shifted up and not fully showed on screen.

My device is iOS 8.3, any idea?

Identify when a user selected a date.

I'm changing a table view scroll whenever the delegate didSelectDate: is called.
Though I'm also selecting a date programatically sometimes, which results in didSelectDate: being called when I don't need it to be. Is it possible to identify when a user has selected a date & when I have set the selected date?

Rewrite Demo App

In Swift?
Examples also with containment & presented modally.

Add Events For particular day

sample
Your are doing a great job thank you for your valuable complement ,I need to know that Is there any provision to add events for dates like the image above
Thanks,
Rix

Delegate to set circleColor & textColor for selected date

Expected to have a delegate method to dynamically set custom color for the selected state as well like:

- (UIColor *)simpleCalendarViewController:(PDTSimpleCalendarViewController *)controller circleColorForSelectedDate:(NSDate *)selectedDate

and

- (UIColor *)simpleCalendarViewController:(PDTSimpleCalendarViewController *)controller textColorForSelectedDate:(NSDate *)selectedDate

Setting different colors here will only apply to the dates which is currently selected

This:
[[PDTSimpleCalendarViewCell appearance] setCircleSelectedColor:[UIColor orangeColor]];
[[PDTSimpleCalendarViewCell appearance] setTextSelectedColor:[UIColor purpleColor]];

alone won't help if you need different colors depending on the date.

Need a "currentDate" parameter or equivalent to set the current date to

While the firstDate and lastDate work fine, there doesnt seem to be a way to set the currentDate: the date at which the calendar should focus on especially at start which may be in between the first and last date.

In my current project, I am trying to let the user choose a date "today or earlier", but I want the calendar to focus on today. Setting first date to Jan1, 1970 and last date to today focuses the calendar on Jan 1, 1970. I want to set the calendar to today.

weekdayHeaderEnabled = true - does not show any Day heading

Any idea if I have made a mistake or stumbled on a bug? I have been using PDTSimpleCalender in my app for about 4 months. Works great. Love this library.

Issue: When I set the weekdayHeaderEnabled to true, nothing happens. I can see the option (the predictive text picks the fact it can see the weekdayHeaderEnabled option) I can even set the values. Everything compiles fine.

I am using the latest version of PDTSimpleCalender (v0.9.1)

internal class calenderCollectionView: PDTSimpleCalendarViewController, PDTSimpleCalendarViewDelegate {

var onDataAvailable : ((data: NSDate) -> ())?

func sendData(data: NSDate) {
    // Whenever you want to send data back to viewController1, check
    // if the closure is implemented and then call if it is
    self.onDataAvailable?(data: data)
}

override func viewDidLoad() {
    super.viewDidLoad()
    title = "Select Date"

    // initialize my calender
    self.delegate = self
    self.firstDate = NSDate().month - 1
    self.lastDate = NSDate().day + 1
    self.weekdayHeaderEnabled = true
    self.weekdayTextType = .Short
    self.calendar = NSCalendar.currentCalendar()
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, isEnabledDate date: NSDate!) -> Bool {
    return true
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, didSelectDate date: NSDate!) {
    sendData(date)
    dismissViewControllerAnimated(true, completion: nil)
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, shouldUseCustomColorsForDate date: NSDate!) -> Bool {
    return true
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, circleColorForDate date: NSDate!) -> UIColor! {
    return DashboardKit.niceBlueColor
}

func simpleCalendarViewController(controller: PDTSimpleCalendarViewController!, textColorForDate date: NSDate!) -> UIColor! {
    return UIColor.whiteColor()
}

}

setting selectedDate has no effects

This is my code:

self.firstDate = NSDate(timeIntervalSinceNow: -60 * 60 * 24 * 365)
self.lastDate = NSDate(timeIntervalSinceNow: 60 * 60 * 24 * 365)
self.selectedDate = NSDate()

In the documentation:
/**

  • Selected date displayed by the calendar.
  • Changing this value will cause the calendar to scroll to this date (without animation).
    */
    You said Changing this value will cause the calendar to scroll to this date (without animation)

However, there's no effects. I have to call self.scrollToSelectedDate(false)

Maybe it's a bug?

How to change color from date after ViewController did load?

I have to update the color from specific dates after i get response data from a server. I know that the method [[PDTSimpleCalendarViewCell appearance] setCircleDefaultColor:[UIColor whiteColor]] exists but how can I access and get the cells?

Allow a selected range

It would be great to have the ability to choose a date range by tapping a start and end date, or even dragging your finger.

Border?

Is it possible to have a reliable border around each cell? Trying to implement this myself gives a hit or miss result.

Deselect date after selection

How can I select a date after the user selected it? I tried calendarView.collectionView deselectItemAtIndexPath: animated: but that doesn't work. Any ideas?

Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:]

I want to show calendar as a view in my viewController. I create caledarVC standart way:

 PDTSimpleCalendarViewController *calendarViewController = [[PDTSimpleCalendarViewController alloc] init];
    [calendarViewController setDelegate:self];
    calendarViewController.weekdayHeaderEnabled = YES;
    calendarViewController.weekdayTextType = PDTSimpleCalendarViewWeekdayTextTypeVeryShort;

But I show calendar VC like this:
[calendarViewController showInView:self.view animated:YES];

I added in PDTSimpleCalendarViewController.m this method:

- (void)showInView:(UIView *)aView animated:(BOOL)animated
{
    CGRect calendarFrame = self.view.frame;
    calendarFrame.origin.y = 64;
    calendarFrame.size.height = CGRectGetHeight(calendarFrame)/1.5;
    self.view.frame = calendarFrame;

    dispatch_async(dispatch_get_main_queue(), ^{
        [aView addSubview:self.view];
    });
}

In time when calendar appeared, error occurred:Assertion failure in -[UICollectionView _createPreparedSupplementaryViewForElementOfKind:atIndexPath:withLayoutAttributes:applyAttributes:]
How can I show calendar view like I want?

bug: weekdayHeader shows even weekdayHeaderEnabled is diable

image

There is a slender line of weekdayHeader (I enable the text into green) of the demo.
It happens in iPhone6 Device running iOS8.

Analyze:

  1. I set the background of weekdayHeader into red and the text label into green. However, it only shows the green text.
  2. I log the frame of weekdayHeader and its subview, all the heights are 0. I doubt it may be a bug of AutoLayout.

Currently I use setHidden: to fix it and hope there is a better way.

Delegate functions slow down the UI

Hey, love the calendar, looks super slick and very customizable. Unfortunately I noticed a visible slow down when using the delegate methods. When I comment them out, it works fine.

Here is what I have:

  • (BOOL)simpleCalendarView:(PDTSimpleCalenderView *)view shouldUseCustomColorsForDate:(NSDate *)date {
    return YES;
    }

  • (UIColor *)simpleCalendarView:(PDTSimpleCalenderView *)view textColorForDate:(NSDate *)date {
    NSString *result = [date compareDate];

    if ([_dates objectForKey:result]) {
    return [UIColor whiteColor];
    }
    else if ([today isEqualToString:result]) {
    return [UIColor whiteColor];
    }
    return [UIColor buddyNavyColor];
    }

  • (UIColor *)simpleCalendarView:(PDTSimpleCalenderView *)view circleColorForDate:(NSDate *)date {
    NSString *result = [date compareDate];

    if ([_dates objectForKey:result]) {
    return [UIColor buddyNavyColor];
    }
    else if ([today isEqualToString:result]) {
    return [UIColor lightGrayColor];
    }
    return [UIColor whiteColor];
    }

_dates is an NSMutableDictionary.

Let me know if I'm doing something that I'm not supposed to in these methods that can cause the slowdown.

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.