views:

194

answers:

2

Im currently using a UITableView like any other, and I am researching into the ability to perform a swipe gesture on the screen, which will then shift the contents of the visible table over to display new content

for example: swiping right-to-left on the screen would change (via animation) the contents within each of the cells on screen to show new data.

What I can do is detect a swipe on the cells, or perhaps on the UITableViewController, but what I dont know how to do two fold:

1) Change data in all cells (could you have a set of hidden views within a custom table cell that animate in and out of each cell per swipe?)

2) How can you do this to all cells?

Thanks a lot Mark

A: 

Well you can detect touches providing the following implementation:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event

Then to reload you cells, Update your DataSource Array and call

[self.tableView reloadData];

jAmi
but i need to animate the change in content of each cell...
Mark
do you want to animate each cell or the whole TableView?if you want to animate the whole table view then you can put this method in the UIView animation block.....
jAmi
A: 

What I ended up doing was creating a custom table cell which had 3 UIViews inside it, only one of which was visible. Then I iterated over each cell on screen, and animated in and out the appropriate UIView from left to right (or the other way around).

I did not, however, end up using a swipe gesture, too fiddly...

Mark