开发者

How would I go about building a calendar UI control for the iPhone/iPad?

There are a few different 3rd party code frameworks that include calendar controls, but most of them have a lot of functionality I don't need, plus most of them lack sufficient documentation on how to use them and I'm not a proficient enough iPhone developer to figure it out using just the code. So I'm going to attempt to build my own and I was hoping you could provide me with some high-level direction to get started. At a high level, how could I build a simple, calendar control that doesn't do much more than display a calendar (month view, with the current date highlighted) and allows the user to selected a date?

Some开发者_如何学JAVAthing that looks like the calendar in the upper right corner of this image...

alt text http://www.techtechies.com/wp-content/uploads/2010/01/calendar-on-ipad.jpg

Thanks so much in advance for your help!


I just got done building a calendar picker class for a client and it was a serious pain in the petoot. You're going to need to get extremely familiar with several classes:

Nscalendar
Nsdate
Nscalendarcomponents

Apple does have pretty good documentation on all these, but you'll end up hacking away eventually especially when you get to things like daylight savings time, etc. The biggest gotcha that I had to deal with is that nsdate is both a container for time and a date. So you have to normalize or "abstract" away the time to work with date comparisons. One thing to look out for is if construct nsdates without times they default to midnight which isn't really midnight on daylight savings dates.

Goodluck!


Making a calendar with calendar controls is not really easy. It took me more than 2 months to build the custom calendar. But still it didn't give the best approach.

The best way is to use the calendar api and then you can implement event kit.

It would be waste of time if you really want to spend 3 months on making calendar.

Use the api

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜