Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Inline Date Picker with static cells

Hi, could you please help me implement an inline date picker in static cells. I have tried the Apple DateCell example project, but the first thing is that it's quite cryptic, and the second thing is that it's based on dynamic prototype cells adding and removing cells, and what I want to do is just to collapse the cell that holds the date picker and show/hide it when the cell above it is clicked to input the date.

I've been trying to follow this tutorial, and while I seemed to have figured out the Part 1 with dynamic cells (highly recommended, much clearer than the Apple DateCell project), the second part doesn't seem to work in iOS 7.1 (as noted in one of the comments there) - the date picker still stays visible when its holding cell's height is set to 0.

I've also found this algorithm, but it seems to do the same thing as in the example above.

Any idea how to do what I need to do? Is there some other way to do it perhaps, and collapsing the cell's height to 0 isn't the best way?

1 Answer

I think I've figured it out. In viewDidLoad I initialise the height of the cell that holds the date picker to 0 and it seems to work properly.