1

I've been struggling to implement something a la the date picker that slides out when adding a calendar event in iOS7. There's an example pictured here. This would be perfect for reducing clutter and keeping context in my app by tapping a cell and revealing more cells or an image. I just cannot figure it out at all.

Does anyone know of a way to do this?

Edit: I'd like to be a bit abstract, for any view to be able to appear when selected and push all the other view content down.

1 Answers1

0

It looks like they have everything in a grouped tableView and they are calling the insertRow method when they want that date picker to show up, and have the picker set the be the content of the cell under the date select button. They are calling the following method to add it:

-(void)insertRowsAtIndexPaths:(nonnull NSArray<NSIndexPath *> *)indexPaths withRowanimation:(UITableViewRowAnimation)animation

With most likely a fade animation from the looks of it:

 UITableViewRowAnimationFade

They also call the removeSections in the same way when they want to get rid of it.

If trying to implement this, make sure you adjust the data your UITableViewDataSource methods are using or it will crash because of an invalid number of rows after the update.

Jsdodgers
  • 5,253
  • 2
  • 20
  • 36
  • Oh, of course. I've tried something *similar* to this, but I couldn't figure out how to embed a view into a table view cell. It would instead make my entire table view go black when selected. I suppose that will be my next challenge. –  Aug 22 '13 at 03:40
  • Why would they be using insertSections here and not insertRows? – John Stewart Aug 18 '15 at 20:30
  • 1
    That's what I meant, sorry. Should be insertRows, not insertSections. (Although you would get the same effect with either call, just depends if you want the new object to be in a new row or section). – Jsdodgers Sep 13 '15 at 08:40