David Demaree
David Demaree

Reputation: 385

How can I implement an iOS calendar picker similar to Hipmunk's?

I'm working on a couple of iOS apps that require the user to select a calendar date, and while the built-in date picker widget is all right, I'd much prefer if users could choose days from a calendar grid, similar to how it works in Hipmunk's iOS app. In that app, users are shown an infinite scroll view showing a grid of days, with each cell showing the month and day. The days of the week are shown in a persistent (i.e. non-scrolling) banner.

In addition to simply showing a calendar, this control should allow dates to be highlighted/selected. Better still, users should be able to select a whole range of dates by tapping on the start and end days' cells, at which the whole range of days should be highlighted.

Any ideas?

Upvotes: 0

Views: 1245

Answers (1)

Matthew Frederick
Matthew Frederick

Reputation: 22305

It's an "infinite" UIScrollView with various other views inside of it. Apple provides a demo infinite UIScrollview in their StreetScroller project.

You'll be allocating and initializing views for the various things you wanted displayed on each day, and probably reusing views at the top for the dates (as one scrolls off to the left you change the date and move it over to the right, reusing it the way a UITableView traditionally does).

Selection is a matter of changing visible state of the objects that back your views.

Upvotes: 1

Related Questions