开发者

Change the contents of a UITableView via a swipe?

Im currently using a UITableView like any other, and I am researching into the ability to perfor开发者_如何学编程m 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


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];


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜