Could you help me with this question, please?
I only need to put a simple Calendar in one of the screens, and I do not have any idea of how can I obtain it, because this UI element is not in the IB.
My client wants the screen like the image below, without the UISegmentedControl (with list, day, month) that has the Calendar app on iPhone.
He wants to see just a calendar, and when you click in one of the days, another view will appear (FYI: view with data loaded from a website corresponding for that day).
http://craigl21.typepad.com/.a/6a00e008db59db8834010535e2d304970c-800wi
So, finally my questions are:
- How to obtain the Calendar?
- I have 'Today' right bar button item of the Navigation bar working (click and another view is loaded). I would like to know how can I put a similar function for the days of the calendar, which I suppose all of them are buttons and I do not know how can I access to them (as I do not know anything about the Calendar element yet).
- By default, today's date must be selected in blue when you load this Calendar view, and when you press any of the days, another view will be loaded. If today's date is selected initially, when I load the Calendar view, the new view with today's details would be loaded immediately? (how could avoid this behaviour?) or hopefully, the calendar would wait for my click on today's date (or any other date)?
Your help will be much appreciated.
The calendar you ar looking for is the NSGregorianCalendar. Used with NSDateComponents and NSDate it is possible to create a custom calendar like the one shown in your link.
You need a custom object for the tiles with a property of NSDate which is where you can get the label date from using NSDateComponents. You can also assign a method to the delegate so when your date cell object is touched it tells the delegate it was touched and you can then do what you want...
The NSCalendar classes are only used for date calculation and apple does not provide a standard calendar element as a part of their UIKit library. However, take a look on this github project, someone published a project that contains a custom made calender UI.
https://github.com/guicocoa/calendar.
It's all open source ofcourse, so you can adjust the design and functionality as you need
You can use https://github.com/devinross/tapkulibrary calendar for you app If you want to add some event on date selection then you need to import events from your app to native iphone calendar? You should use EventKit for that.
In addition to the calendar app that @aporat suggests, you should check out Kal, which is a very full-featured recreation of the Calendar app's interface, and is open source and editable and customizable.
It is kind of crazy that there's no native calendar UI, but there it is.