patchthecode / JTAppleCalendar

The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable
https://patchthecode.com
MIT License
7.57k stars 810 forks source link

Questions on starting of calendar #356

Closed gilgameshex closed 7 years ago

gilgameshex commented 7 years ago

Hi there,

I have bumped into an errors today when I am continue programming on the calendar. I was trying to do the code on having the calendar on today's date instead of the calendar start date, so I did this and it returned an error:

calendar starting 2

Also, another question, I am planning to use NSDefault to store some data on to the calendar. However, I am not quite sure how, since it will be different for each date. Any suggestions?

Thank you so much for your time. (I am catching up with deadlines, so sorry for suddenly throwing a bunch of questions on you)

patchthecode commented 7 years ago

it should be calendarView.scrollToDate(Date())

Also, why are you storing information onto the calendar? You need to use your own dataSource to store information.

Imagine the calendar as a UITableView. The same way as you would not store information unto the UITableView is the same way you should not store information inside of the calendar.

gilgameshex commented 7 years ago

Thanks for the quick reply. I will think about that. 🍻

gilgameshex commented 7 years ago

What if its something like user putting notes in, like a timetable or something, or say, a diary. Can I do that?

gilgameshex commented 7 years ago
screen shot 2017-03-22 at 8 23 49 pm

Something like this

patchthecode commented 7 years ago

This library is just like a UICollectinView or a UITableView

You can do literally anything with it (including what you have asked). I believe your doubt is possibly because you are maybe new to using UITableViews and UICollectionViews?

gilgameshex commented 7 years ago

yes 😢

patchthecode commented 7 years ago

Hmm.. i would really love to help, but honestly there are many tutorials around that will do a better explanation that i possibly can in this chat box.

Here is one example of a tutorial. But there are very many online.

In a nut shell, (with my bad explanation though) it goes like this. You have a dataSource (which has your stored content). This can be an Array or a Dictionary.

On a normal UITableview, you will grab that data in the array/Dictionary using the index provided by the cellForItem function of the UItableView's delegate function.

With the calendar however, you grab that information using (not an index) but a date provided by the willDisplayCell delegate function.

Haha thats the best I can do. Hopefully you have your problem resolved. I will close this issue now, as it is not directly related to the calendar. Have a good one. 🍻

gilgameshex commented 7 years ago

That will do. Thanks so much 🍻