jaykz52 / ckcalendar Goto Github PK
View Code? Open in Web Editor NEWA sleek, easily customized calendar control for iOS.
Home Page: www.cozykozy.com
A sleek, easily customized calendar control for iOS.
Home Page: www.cozykozy.com
I added - (void)setDateBorderColor:(UIColor *)color;
to the header file so I can change the background color of the calendar container. Any reason this was not exposed already?
If the calendar's firstWeekday is zero (which it is on my system), getDaysOfTheWeek crashes with an array out-of-bounds error:
2012-08-17 11:10:01.604 orderoso-dev[60836:c07] Unhandled Exception: *** -[NSArray subarrayWithRange:]: range {4294967295, 8} extends beyond bounds [0 .. 6]
0 CoreFoundation 0x015df03e __exceptionPreprocess + 206
1 libobjc.A.dylib 0x012d4cd6 objc_exception_throw + 44
2 CoreFoundation 0x0155c061 -[NSArray subarrayWithRange:] + 273
3 orderoso-dev 0x0005ee9d -[CKCalendarView getDaysOfTheWeek] + 285
4 orderoso-dev 0x00059fd8 -[CKCalendarView initWithFrame:] + 4040
I put in a local fix that seems to take care of it in -getDaysOfTheWeek
- NSUInteger firstWeekdayIndex = [self.calendar firstWeekday] -1;
+ NSUInteger firstWeekdayIndex = ([self.calendar firstWeekday] + 6) % 7;
This prevents a "negative" unsigned integer when firstWeekday is zero.
I know you have suggested to keep record of selected dates a user click on, but I want to have multiple dates selected on GUI as it does currently for a single date. And deselect same as it does now by clicking over the selected one. I know it's not a issue but I had to ask for my concern Thanks
1> is there any way i can put image on date item background to show it as highlighted?
please add a version tag to your repo, thanks
As i have to hide and show calendar. What i need is whenever i show calendar it opens with specific month what i pass ?Any idea
thanks
Baibhav
Animating into a view with the Calendar on it or animating the Calendar (Tested on iPhone 4) results in terrible frame rates/choppyness however after removing the code below (with little visual loss) it becomes butter smooth. I suggest that you either use a .png for the opacity/shadow or ditch it all together because otherwise you get just awful performance.
self.layer.cornerRadius = 6.0f;
self.layer.shadowOffset = CGSizeMake(2, 2);
self.layer.shadowRadius = 2.0f;
self.layer.shadowOpacity = 0.4f;
self.layer.borderColor = [UIColor blackColor].CGColor;
self.layer.borderWidth = 1.0f;
I need to set max date as current date. It should not allow user to select a date greater than current date.
i added ckcalendar view in my view controller but previous month and next month not coming
In order to show the range of possible styles for CKCalendar, we need to put together a number of themes that are both attractive and show the diversity of what is possible with the provided "theme extension points."
Screenshots of these themed CKCalendar's could be featured on the homepage or in the wiki.
The calendar currently leaves blank spots open when a month begins on a day other than the start of the week, or ends on a day other than the end of the week.
The remaining spots in the first and last row should be filled with the previous and next months' dates up. The styling of these "Non-current month" date cells should be configurable so that they can be distinguished against dates that fall in the currently selected month.
How I can display dates with an Array???
When select Calendar in week mode, and Day mode,
Event Dot is not visible.
I have looked previous issues and found out that to be able to mark some dates I need to call 'configureDateItem:forDate:' , but somehow when I call that function, according to breakpoints it is working but it doesn't update display of calendar.
here is my sample code:
-(void) chooseDisabledDates :(EKEvent *)event
{
NSDate *startDate = event.startDate; // your start date
NSDate *endDate = event.endDate; // your end date
NSDateComponents *dayDifference = [[NSDateComponents alloc] init];
NSMutableArray *dates = [[NSMutableArray alloc] init];
NSUInteger dayOffset = 1;
NSDate *nextDate = startDate;
do {
[dates addObject:nextDate];
[dayDifference setDay:dayOffset++];
NSDate *d = [[NSCalendar currentCalendar] dateByAddingComponents:dayDifference toDate:startDate options:0];
nextDate = d;
} while([nextDate compare:endDate] == NSOrderedAscending);
self.disabledDates = nil;
self.disabledDates=[NSArray arrayWithArray:dates];
for (NSDate *disabledDate in self.disabledDates) {
CKDateItem *item=[[CKDateItem alloc] init];
item.backgroundColor=[UIColor redColor];
item.textColor = [UIColor whiteColor];
[self.ckCal.delegate calendar:self.ckCal configureDateItem:item forDate:disabledDate];
//[self calendar:self.ckCal configureDateItem:item forDate:disabledDate];
}
//[self.ckCal setNeedsDisplay];
//[self.ckCal reloadData];
}
Hi,
Please create a new tag so that cocoapod user get updated code.
Thanks,
Amit
hey,
i'm having hard time changing the calendar layout to rtl.
can someone help me with this?
Thank
Hello,
Thanks for your nice tool.....
I would like to propose a possible enhancement...
Can you add the possibility to change and choose year?
Thank you again....
George Gerardis
I have a problem: when calculating the months to sit it generates events calendar events normally, however in the months from October to February nothing appears on the layout.
CKCalendarView method calculateDayCellFrame: calculates frame with float origin and size, as result text in button is blurred
2013-04-11 11:40:50.645 Calendar[1012:f803] dateButton.frame = {{0, 23}, {43.2857, 43.2857}}
2013-04-11 11:40:50.646 Calendar[1012:f803] dateButton.frame = {{44.2857, 23}, {43.2857, 43.2857}}
2013-04-11 11:40:50.646 Calendar[1012:f803] dateButton.frame = {{88.5714, 23}, {43.2857, 43.2857}}
Im using ckcalendar(https://github.com/jaykz52/CKCalendar) in one of my application. In arabic locale i need a different layout of days, currently it is showing as following:
but i need its format as follow:
الأحد الأثنين الثلاثاء الأربعاء الخميس الجمعة السبت
the difference between both the format is that after changing its locale, ckcalendar days are still Right to left.
can any one let me know what should i need to do to fix this. as i try different things but i still get desired results.
There seems to be a layout bug in the code, if you set the adaptHeightToNumberOfWeeksInMonth to NO, then move to October 2013 or March 2014, there is a layout issue with the cells of post months.
I need to get start date and end date in current calendar
Any simple way to do it ?
I'm using CKCalendarView for an events app. I'm parsing dates of event via a XML (RSS feed) into an array, anyone have any idea how I can put those dates into the calendar, so only them dates are selectable?
Thanks in advance
I have found that when it recognizes a month starts the first day mid-week schedule is set incorrectly.
Maybe this can be a solution to the problem of managing the day in the week:
Declare a variable in CKCalendarView.h BOOL (Ej. BOOL moveFirstRow).
And change this lines of code:
(CGRect)calculateDayCellFrame:(NSDate *)date {
int row = [self weekNumberInMonthForDate:date] - 1;
int placeInWeek = (([self dayOfWeekForDate:date] - 1) - self.calendar.firstWeekday + 8) % 7;
if (row == -1)
moveFirstRow = YES;
if (moveFirstRow == YES)
return CGRectMake(placeInWeek * (self.cellWidth + CELL_BORDER_WIDTH), (row * (self.cellWidth + CELL_BORDER_WIDTH)) + CGRectGetMaxY(self.daysHeader.frame) + CELL_BORDER_WIDTH + (self.cellWidth + CELL_BORDER_WIDTH), self.cellWidth, self.cellWidth);
else
return CGRectMake(placeInWeek * (self.cellWidth + CELL_BORDER_WIDTH), (row * (self.cellWidth + CELL_BORDER_WIDTH)) + CGRectGetMaxY(self.daysHeader.frame) + CELL_BORDER_WIDTH, self.cellWidth, self.cellWidth);
}
(void)moveCalendarToNextMonth {
moveFirstRow = NO;
NSDateComponents* comps = [[NSDateComponents alloc]init];
[comps setMonth:1];
self.monthShowing = [self.calendar dateByAddingComponents:comps toDate:self.monthShowing options:0];
}
(void)moveCalendarToPreviousMonth {
moveFirstRow = NO;
self.monthShowing = [[self firstDayOfMonthContainingDate:self.monthShowing] dateByAddingTimeInterval:-100000];
}
With this solution when it finds that the row = -1, add the cell size and the separator, adjusting correctly.
On the other hand this function checks each time it changes from month.
It may not be the right solution, but it works :)
It seems that the calendar always displays the current month on init even when a date in a previous month is specified with the selectedDate
property.
For instance:
_calendarView = [[CKCalendarView alloc] initWithStartDay:startSunday];
_calendarView.delegate = self;
_calendarView.selectedDate = _theDate; //_theDate is last month
[self.view addSubview:_calendarView];
When _theDate
is in the previous month, the calendar will display today's month and when navigation to last month, it will properly have the selected date colored.
Hi, can I modify frame of calendar? I need reduce width because I want render calendar into my popup.
Thanks
Currently, the README doesn't describe what's stylable, what options are available on the calendar, or even what callbacks are available on the delegate. Document this so developers know what they're working with.
Is there a snippet available how to select from:till date? Like, multiple days?
The api read me says its possible with this calendar.
Thanks!
CKCalendar is the most simple and easy to use iOS calendar that I found. But I have a question regarding it.
I want to show a dot on a specific date on which there is an event, how can I do this?
How CKCalendar can interact with the system calendar for showing the events?
Hi guys, how are you? This is my favorite objective c calendar class, and the collaboration here is so cool.
I need some help of you. In my project, I have a View controller with a UIView and a UIButton. This UIView receives the CKCalendar and the UIButton in the view controller is a button to go back in the current day/date. I'm trying several ways but I can not do this.
Some one help me please.
Regards.
Guilherme Rosa
When I compile for a 64-bit binary I get the following warning
Pods/CKCalendar/Source/CKCalendarView.m:81:54: Values of type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead
So, If I want to add label or subview, how I could to do it?
Hello,
First, thank you for this amazing calendar.
I need to disable the last dates and those in after 2 months for example.
How can I make this?
Thank you
I'm getting this error when running an app on iOS that uses the Pod for your component:
CGContextSetBlendMode: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
Is this a known issue?
I would like to suggest the creation of a function that allows to show several selected days in the calendar like, for example: sundays and saturdays, or holidays.
Is that possible?
Thanks and congrats for the code.
Cassio
Could you make it so that its able to jump to a specific monthi if specified?
In demo application, when I select a date, it is shown in a UILabel I guess at the bottom of the page but it is wrong. For example when I select August 16th 2012, the output is always the one day before; August 15th 2012.
Hi, Is possible enable time also?
I added the following code to CKCalendarView to create an event for a specific date.
-(void)setEventForDate:(NSDate *)date isHoliday:(BOOL)holiday withTitle:(NSString *)title{
// NSLog(@"Date received for event %@", date);
for (DateButton *dateButton in self.dateButtons) {
if (dateButton.date) {
NSLog(@"%@", dateButton.date);
if ([date isEqualToDate:dateButton.date]) {
NSLog(@"Matched date %@", dateButton.date);
UIColor *eventColor;
UIColor *textColor;
if (holiday) {
eventColor = [UIColor grayColor];
textColor = [UIColor whiteColor];
} else {
eventColor =[UIColor colorWithRed:0.557 green:0.137 blue:0.267 alpha:1];
textColor = [UIColor whiteColor];
}
UILabel *eventTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, dateButton.frame.size.height - 15, dateButton.frame.size.width, 15)];
[eventTitle setNumberOfLines:0];
[eventTitle setText:title];
[eventTitle setTextColor: textColor];
[eventTitle setBackgroundColor:eventColor];
[eventTitle setAdjustsFontSizeToFitWidth:YES];
[eventTitle setTextAlignment:NSTextAlignmentCenter];
[dateButton addSubview:eventTitle];
}
}
}
}
The trouble I am having is that the the view shows in the cell the day before the correct date.
For example, if date passed in is 10/20/2013, the UILabel appears in the cell for 10/19, even though the debugger shows that the dateButton is 10/20.
I've narrowed it down to onlyShowCurrentMonth. If set to YES, the view appears in the correct cell otherwise it shows up in the day before.
I used it in a popover. Very good work m8! really liked it.
I added another delegate method, so the popoverview size will keep track with the calendar size.
the method didchangemonth could not be used for this, as the calendar layout was only updated afterward.
put the hook in layoutsubviews.
-(void)calendar:(CKCalendarView *)calendar didLayoutCalendar:(CGRect)rect{
self.contentSizeForViewInPopover=calendar.frame.size;
}
I'm trying to modify the cell/box of the selected item and change its properties, like changing its font-size or border. The delegate method I'm using is
- (void)calendar:(CKCalendarView *)calendar didSelectDate:(NSDate *)date {
}
but there is no object to use to access the cell.
I'm just new to iOS , sorry for my newbie question.
Compiler warning:
CKCalendarView.m:308:16: 'setWeek:' is deprecated: first deprecated in iOS 7.0 - Use setWeekOfMonth: or setWeekOfYear:, depending on which you mean
Hello,
I use in my App your Calendar. This morning I build my Project again and since I get following Error:
-[__NSCFCalendar components:fromDate:]: 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.
Here is the backtrace where this occurred this time (some frames may be missing due to compiler optimizations):
This Error comes by following line:
CKCalendarView *calendarSubView = [[CKCalendarView alloc] init];[/code]
Is this a Issue or is it because iOS 7 on my Test Device?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.