Comments (4)
Your delegate implementation looks correct. Are you clearing _eventsArray before adding events for each date?
from mbcalendarkit.
Hi Moshe,
Your diagnostic was spot on.
I'll take the opportunity to share my findings here for reference.
First of all, NSDateFormatter is needed because date and time must adjust to a specific format:
[dateformatter setDateFormat:@"yyyy/MM/dd"];
[dateformatter setDateStyle:NSDateFormatterShortStyle];
The core data objects' time I had were different than 00:00 (minutes and seconds), and they were not showing in the calendar.
Then I loop through the core data array to create events and build the eventsArray:
for (Task *task in _taskArray)
{
NSDate *date = [dateformatter dateFromString:task.dateString];
NSString *title = [NSString stringWithFormat:@"%@", task.title];
event = [CKCalendarEvent eventWithTitle:title andDate:date andInfo:nil];
[eventsArray addObject: event];
}
Finally, I iterate through the eventsArray to build the Dictionary used by the CKCalendarViewDataSource:
[eventsArray enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL *stop) {
if ([_calendarData objectForKey:[[eventsArray objectAtIndex:idx]date]]) {
// Dictionary already contains object with this date
NSMutableArray *existingDate = [[NSMutableArray alloc]init];
[existingDate addObjectsFromArray:[_calendarData objectForKey:[[eventsArray objectAtIndex:idx]date]]];
[existingDate addObject:object];
[_calendarData setObject:existingDate forKey:[[eventsArray objectAtIndex:idx]date]];
}
else {
NSMutableArray *uniqueDate = [[NSMutableArray alloc]init];
[uniqueDate addObject:object];
[_calendarData setObject:uniqueDate forKey:[[eventsArray objectAtIndex:idx]date]];
}
}];
from mbcalendarkit.
Glad you worked it out. Two questions:
- Do you mind posting a screenshot of the correct calendar view?
- May I close this?
from mbcalendarkit.
Sure, this issue can be closed.
Here's the view:
The key is to build the Dictionary with the correct structure:
{
"July 15, 2014" = (
"<CKCalendarEvent: 0x1123128e0>"
);
"July 16, 2014" = (
"<CKCalendarEvent: 0x11230fb10>",
"<CKCalendarEvent: 0x11230ff00>"
"July 17, 2014" = (
"<CKCalendarEvent: 0x11230d880>",
"<CKCalendarEvent: 0x11230df30>"
);
}
from mbcalendarkit.
Related Issues (20)
- Bring `CustomCellProvider` to the HeaderView
- Cell Transition Animation Bug HOT 1
- Unit Test Cell Width Code
- CalendarView doesn't take in account firstDayOfWeek HOT 10
- Disable dragging on CustomCellProviding HOT 5
- Performance Profiling HOT 1
- Allow Custom Next/Back Images
- Month to Week Transition observable gap
- how refresh the data HOT 1
- how avoid show the tab bar HOT 1
- how to use background color in every sunday?
- Hello Project's Owner
- How to show more than one event in single date for MBCalendarKit for swift 4 HOT 1
- Changed it to NSCalendarIdentifierIslamic not working
- How to achieve calendar color customization? HOT 1
- How to change colors of calendar header, arrows, and selected cell?
- How to hide rows in Month display mode.
- Installing mBCalendarKit via Cocoapods is getting failed. HOT 1
- Calendar week view - pressing forwards/backwards buttons sometimes skips a week
- Tab Bar Text...
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mbcalendarkit.