1

I need to save the state of my UITableViewCell (specifically, the offset of an embedded table view). Is prepareForReuse a good place to do this? If it were a UIViewController, I would look into viewWillDisappear, but obviously that's not an option here.

I'm thinking I need to save the state whenever the cell gets marked for reuse (taken "off" the table view). I'm trying to think of some weird case where a cell would be taken off the table view, not have prepareForReuse called, and then be put back on the UITableView (thereby skipping my saving code).

Thanks!

Edit For More Info

I've created a Pulse Reader like interface. Illustration here: When Do You Need To Reset the view.frame Property After a Transformation iOS

I need to save the location of the embedded, horizontal table views so that as a user scrolls a horizontal table view out of view (by scrolling the vertical table view) and then scrolls that horizontal table view back into view (again, by scrolling the vertical table view) that the horizontal table view is in the same position as the user left it. That is, if they are looking at cell 15 of row 1, then scroll to row 20, then back to row 1, I want cell 15 to be right where they left it.

Community
  • 1
  • 1
Tyler DeWitt
  • 23,366
  • 38
  • 119
  • 196
  • Could you be a bit more specific on what exactly you're trying to achieve? What do you mean by offset? Maybe there is a better approach to what you're trying to do. What is that offset? – huesforalice Oct 18 '11 at 21:19

1 Answers1

0

I implemented this same design, before the Ray Wenderlich Tutorial came out. I ended up using, and expanding this control: APCarouselView. Not sure how much this will help you, but using this control was very easy for me, and as long as I kept a reference to each CarouselView then it kept it's scroll location.

Rob Booth
  • 1,792
  • 1
  • 11
  • 22