johnvuko / jtcalendar Goto Github PK
View Code? Open in Web Editor NEWA customizable calendar view for iOS.
License: MIT License
A customizable calendar view for iOS.
License: MIT License
Hi! Thank you for this great control.
When you use this Calendar inside a Navigation controller and you try to return to previous view, the Calendar, just go to previous month too, and it keeps visible for a second over the previous view.
Any thoughts to solve this?
Thanks SO much!
I am having an issue with the calendar reloading after the view is presented. For example, right now it shows October then scrolls to the current month of December. I don't see this issue with the example app, but I also don't see any differences in my code from the example.
Or should I add this function myself? Thanks in advance.
JTCalendar is good, if support 18n will be better.
In your second example screen shot your show what looks like an Hour view below the calendar. But I could not find the functionality for this. Is this something that is available and if so how is it turned on?
Please inform us how.
I am trying to change currentDate property of JTCalendar, but it doesn't changes selected day. Select on touch works perfect.
Looking through the source, the only way I could find to select the current month when first loading was to perform these in sequence:
[calendar loadNextMonth];
[calendar loadNextMonth];
[calendar reloadData];
This is due to the way it's loading two months either side of the current month, and doesn't scroll to the current month, but shows currentMonth - 2 months as the default calendar.
It seems to me that setCurrentDate should automatically scroll to the current month.
Hi Jonathan,
Thanks for sharing such a great library. This is really awesome.
While trying your example app I noticed that when you switch it to Week mode, you can swipe on the Month names and changes the month but not the days below. Swipe on MonthView is disabled initially but once you start swiping on the days it will get enabled.
Hi I just downloaded your library and sample, but I can't run it since the library is not precompiled.
Can I have a little help compiling the pods library ?
I installed cocoa pods, but I have no idea how to work with it.
when I need to reload current MonthView, I must reload [self.contentView reloadData];
There isn't a convenient way to reload current MonthView,it cost much to reload the whole ContentView(#define NUMBER_PAGES_LOADED 5 // Must be the same in JTCalendarView, JTCalendarMenuView, JTCalendarContentView
). NUMBER_PAGES_LOADED MonthViews will reload at the same time.
NUMBER_PAGES_LOADED change 5 to 3. the total Memory reduce about 10MB,and it become light.
But it much easier to load a white view .
hope new source File and effective Source File come out.
btw: I like JTCalendar very much, i learned a lot from you.thanks for sharing.
best regards!
Thanks for the help the other day. I have all of that working now.
How do I achieve this:
https://github.com/jonathantribouharet/JTCalendar/blob/master/Screens/example.png
I've created the view and I can give it a list of events, but I can't figure out how to display them. Another hint would be great.
Thanks,
Jeff
I was wondering if there is an efficient method to navigate to the current date in case you are viewing some other month ?
I have this, it selects the current date but does not go to the right month
Edit, figured it out, nvm. Had to do -
self.calendar.currentDate = [NSDate date];
When dragging the calendar content view and it snaps (animates smoothly) into position, about 300ms after its done it jumps around 5 pixels to the right.
Recommend you DOWNLOAD this movie to see it in action:
https://www.dropbox.com/s/6j320saykp0h6kh/JTCalendarSwipeGlitch.mov?dl=0
I'm new to calendars in iOS, so this is probably just an newbie thing. Can you give me a hint about how to read my calendar events into the calendar view? I'm sure they need to be supplied to the datasource, but in what kind of object?
Thanks,
Jeff
I have a navigation controller with 3 VC, one of them has a button that goes to the VC where the calendar is displayed. Once there, if I go back it crashes.
The reason is that is sending a message to the calendar (JTCalendar object), that was deallocated. The message is “scrollViewDidScroll:” and it is a UIScrollViewDelegate method.
I have been trying a lot of things, but nothing works. I was wondering if you know if there is somewhere in your code where I can prevent calling it when the calendar is deallocated.
Here you have the Zombie message:
-[JTCalendar scrollViewDidScroll:]: message sent to deallocated instance 0x1740933d0
Wonderful calendar component , but would like to add this to my view controller without using xib
Tried the below Code but its of no use
Could you please provide me some suggestions pls ?
self.calendar = [JTCalendar new];
self.calendarMenuView = [[JTCalendarMenuView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 50)];
self.calendarContentView = [[JTCalendarContentView alloc]initWithFrame:CGRectMake(0, self.calendarMenuView.bottom, self.view.bounds.size.width, 500)];
// All modifications on calendarAppearance have to be done before setMenuMonthsView and setContentView
// Or you will have to call reloadAppearance
{
self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Sunday == 1, Saturday == 7
self.calendar.calendarAppearance.dayCircleRatio = 9. / 10.;
self.calendar.calendarAppearance.ratioContentMenu = 1.;
}
[self.calendar setMenuMonthsView:self.calendarMenuView];
[self.calendar setContentView:self.calendarContentView];
[self.calendar setDataSource:self];
Hi Jonathan,
This calendar looks awesome. I am new in ios programming and I would to use this calendar in to my application. The only issue that I have is that I want to fetch some events from a website in to this calendar. Where/How can I do this?
Thank you.
When trying to run pod install on the Example folder this error arises
[!] Unable to satisfy the following requirements:
- `JTCalendar (from `../`)` required by `Podfile`
JTCalendarMenuView.h
- (void)setMonthIndex:(NSInteger)monthIndex withYear:(NSInteger) year;
JTCalendarMenuView.m
- (void)setCurrentDate:(NSDate *)currentDate
{
self->_currentDate = currentDate;
NSCalendar *calendar = self.calendarManager.calendarAppearance.calendar;
NSDateComponents *comps = [calendar components:NSCalendarUnitMonth | NSCalendarUnitYear fromDate:currentDate];
NSInteger currentMonthIndex = comps.month;
NSInteger currentYear = comps.year;
for(int i = 0; i < NUMBER_PAGES_LOADED; ++i){
JTCalendarMenuMonthView *monthView = monthsViews[i];
NSInteger monthIndex = currentMonthIndex - (NUMBER_PAGES_LOADED / 2) + i;
monthIndex = monthIndex % 12;
[monthView setMonthIndex:monthIndex withYear:currentYear];
}
[self.calendarManager.dataSource calendarDidChangeMonth:self.calendarManager date:currentDate];
}
JTCalendarMenuMonthView.h
- (void)setMonthIndex:(NSInteger)monthIndex withYear:(NSInteger) year
{
static NSDateFormatter *dateFormatter;
if(!dateFormatter){
dateFormatter = [NSDateFormatter new];
dateFormatter.timeZone = self.calendarManager.calendarAppearance.calendar.timeZone;
}
while(monthIndex <= 0){
monthIndex += 12;
}
NSString *month = [[dateFormatter standaloneMonthSymbols][monthIndex - 1] capitalizedString];
textLabel.text = [NSString stringWithFormat:@"%@ - %ld", month, (long)year];
}
I have a today button at the top of my calendar and I am using the provided delegates. If i select the 'today' button in a different month, it works as expected, it changes the selected day to the current date and theres only one day dot.
However, lets say I select a date in the same month and then i click the today button, the app doesn't do anything, but it should change the day dot to the current date and remove the second day dot. But it still shows two day selected dots.
While using the calendar I've met issues with memory usage. Actually, it takes more than 11 MB on my iPhone 5 which doesn't make the best performance. I didn't make much code exploring but from the first sight it has some optimization work to be done, especially in case of loading pages with dates. It'd be really nice if you could improve that stuff.
Hello,
I have tried looking through the code for the swipe left or right to change months and would like to change it to a vertical up/down swipe to change the months. Any hints?
In the second screenshot is an agenda view for the day below the calendar. Is that included or was that from another app/library?
The same as Swipe glitch #1 but for the menu showing the name of the months
Hi Jonathan, thanks for your cool calendar.
Just wondering if it is possible to know if the user had scrolled left or right in weekview ?
row 147:
(void)setCalendarManager:(JTCalendar *)calendarManager
{
self->_calendarManager = calendarManager;
for(JTCalendarMonthView *view in monthsViews){
[view setCalendarManager:calendarManager];
}
for(JTCalendarMonthView *view in monthsViews){
[view setCalendarManager:calendarManager];
}
}
Hi, @jonathantribouharet
I add a alpha animation effect on the month menu view. The more the menu is close to the center of the screen, the greater the alpha is. I also leave a interface for setting the max alpha value and the min.This is the effect
PR #52
Hello Jonathan,
Thank you for such a nice calendar. It might be even better, if there was an explicit way of selecting a date (simple adding a CircleView onto the day one). I hope you find this feature useful to work on.
Thank you and happy coding time! 👍
When i selected date ·[self.calendar setCurrentDate:[NSDate date]]·,it's nice that has a transition animation.
week mode need to show selected date accurately.
when i selected one date and change mode to week mode, it's hard for me to find last selected date.
waiting for your new code.
thx for reading.
best regards!
Hello,
i want to calculate dynamically change scrollview height.
suppose, i am in November month that month view and scrollview is big and then i go to February month that month view is small but scroll view is not changes dynamically...
Hi developer;
I'm a developer as well, and I'm trying to implement inside JTCalendar some event taken from NsDate*dateSelected
In it I've some date in "dd/MM/yyyy HH:mm":
NSLog(@"%@",dateselected)
"2014-12-09 00:05:41.908 Database Demo[1348:31927] 2014-12-09 09:39:37 +0000
2014-12-09 00:05:41.911 Database Demo[1348:31927] 2014-12-14 09:32:26 +0000
2014-12-09 00:05:41.913 Database Demo[1348:31927] 2014-12-20 08:08:09 +0000"
When I try to implement the date of "dateSelected" in the eventsByDate[key], it makes just one event (the last one that I've insert in the dateSelected).
Here the code:
(void)createEvents
{
eventsByDate = [NSMutableDictionary new];
NSDate *myDate = dateSelected;
NSString *key = [[self dateFormatter] stringFromDate:myDate];
if(!eventsByDate[key]){
eventsByDate[key] = [NSMutableArray new];
}
[eventsByDate[key] addObject:myDate];
}
}
Can you help me ???
Have a nice day......;)
First of all, thank you for this great library. It is awesome.
But I amb getting a problem.. I have an array with a huge number of EKEvents, and in order to add the dot at the bottom on the month view, I am doing this:
(BOOL)calendarHaveEvent:(JTCalendar *)calendar date:(NSDate *)date
{
NSArray *eventsArray = [self.eventManager getAllEventsForSelectedCalendars];
for (EKEvent *event in eventsArray) {
if (event.startDate == date) {
return YES;
}
}
return NO;
}
And yes, it works. But it takes too much time to repaint the view, so the user cannot change smoothly more than one month at once.
Do you have another way to do it?
Thanks in advance
Getting armv architecture
errors on compiling code for iPad device.
ld: warning: ignoring file /Users/vaibhavs/Documents/vaibhavsprojects/Samples/JTCalendar/Example/libPods-JTCalendar.a, file was built for archive which is not the architecture being linked (armv7): /Users/vaibhavs/Documents/vaibhavsprojects/Samples/JTCalendar/Example/libPods-JTCalendar.a
ld: warning: ignoring file /Users/vaibhavs/Documents/vaibhavsprojects/Samples/JTCalendar/Example/libPods.a, file was built for archive which is not the architecture being linked (armv7): /Users/vaibhavs/Documents/vaibhavsprojects/Samples/JTCalendar/Example/libPods.a
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_JTCalendar", referenced from:
objc-class-ref in ViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Please describe how to compile static library for an universal application.
Hi there, in some cases the calendar day view should not be allowed to select, I think it's better to have a delegate with a method whether we should select the date. The datasource didn't work as a datasource but as a delegate.Can we change the data source to delegate too?
Hi,
I try to set timezone after create JTCalendar,but seems not work,here is my code:
_calendar = [JTCalendar new];
[_calendar.calendarAppearance.calendar setTimeZone:[[NSTimeZone alloc] initWithName:@"Asia/Shanghai"]];
NSLog("%@", [NSDate date]); //output: 2014-12-17 05:33:29
My local time is 2014-12-17 13:33:29
How to set the right timezone?
Thanks for your help.
Hi, Jonathan!
Thank You for your work! I use your calendar - it looks excellent.
But i can not understand, how to skip selection programmatically.
And how to get selected month. Could You help me?
Thank You!
First of all thank you so much for this control. It's a great control. I am just having one issue that when i am in a week mode and i change month from menuView at that time the week is not getting changed.
Thank you once again for the control
Is there a way to change the calendar language to Spanish, even if the iphone has been set to spanish, the calendar keeps showing the month's name in english.
First of all, kudos for your great work. I noticed a weird behavior though when changing mode from month view to week view. Indeed, the week displayed is not the one with the selected day. For example if I select January 1st in month view and switch to week view it will show the week of January 12th to 18th. How can we change that? Thanks
How to customize the appearance of dot (square, start, etc) and multiple dot inside a cell like below screenshot example?
http://www.appunderdog.com/appunderdog/wp-content/uploads/2012/01/calvetica-calendar-with-events.jpg
in JTCalendarAppearance.h, I see it can be modified to fit above requirement
Hi, amazing repo.
Using the code from the Example project, my calendar starts in October 2014.
Any Idea why this is happening and how I can fix it?
Code below;
// Calendar Setup
self.calendar = [JTCalendar new];
// All modifications on calendarAppearance have to be done before setMenuMonthsView and setContentView
// Or you will have to call reloadAppearance
{
self.calendar.calendarAppearance.calendar.firstWeekday = 2; // Sunday == 1, Saturday == 7
self.calendar.calendarAppearance.dayCircleRatio = 9. / 10.;
self.calendar.calendarAppearance.ratioContentMenu = 2.;
self.calendar.calendarAppearance.monthBlock = ^NSString *(NSDate *date, JTCalendar *jt_calendar){
NSCalendar *calendar = jt_calendar.calendarAppearance.calendar;
NSDateComponents *comps = [calendar components:NSCalendarUnitYear|NSCalendarUnitMonth fromDate:date];
NSInteger currentMonthIndex = comps.month;
static NSDateFormatter *dateFormatter;
if(!dateFormatter){
dateFormatter = [NSDateFormatter new];
dateFormatter.timeZone = jt_calendar.calendarAppearance.calendar.timeZone;
}
while(currentMonthIndex <= 0){
currentMonthIndex += 12;
}
NSString *monthText = [[dateFormatter standaloneMonthSymbols][currentMonthIndex - 1] capitalizedString];
return [NSString stringWithFormat:@"%ld\n%@", (long)comps.year, monthText];
};
}
[self.calendar setMenuMonthsView:self.calendarMenuView];
[self.calendar setContentView:self.calendarContentView];
[self.calendar setDataSource:self];
Hello,
I am trying to design my app to show the current month by itself:
December
but right now it looks like this:
vember December Janua
I have tried looking throughout the code and I can't figure it out. Its obviously possible because the example screenshot (the blue one) shows it.
I tried doing NUMBER_PAGES_LOADED 1
and it shows the single month just like I want, but it doesn't scroll to the next months.
Any help would be much appreciated.
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.