views:

102

answers:

2

I have a tableview with cells that have a scrollview in them. The scrollview is paged, 2 pages to be exact, and is meant to be able to quickly compare two small blocks of text.

I'm trying to find a way to remember what the content offset of the scrollview is. Cell reuse is killing me.

I've tried resetting the offset in prepareForReuse or directly in the cellForRowAtIndexPath, but it seems to give me exactly what you'd expect: Randomly offset tablecells after reuse.

Anyone have any ideas?

A: 

Not quite sure if you are trying to remember independent scrolling position, or if you are trying to sync the two tableviews. Assuming the former :

I've not tried this, but if you make each of your tableviews a tableviewcontroller, and add their views to the scrollview, then I would have thought:

1) It would probably just take care of itself

2) you could do your thing in viewWillAppear / viewWillDisapear

Also check this

http://stackoverflow.com/questions/2795900/how-can-i-get-the-uitableview-scroll-position-so-i-can-save-it

especially Ben's comments.

Andiih
A: 

If I'm understanding this correctly, you have a scrollview inside each cell that you want to remember the position of. What you need to do is save the content offset along with the text your UITableViewDataSource is providing and set it in your cellForRowAtIndexPath method.

Peter Zich