开发者

UITableView add new custom cell onto selected cell or another suggestion

I'm really confused about that; I have an example view. it contains an UITableview, this tableview contains approximately four or five rows. I don't know am i right or wrong way ? I'm trying that when the user click to the cell the table, i'm trying to add new custom cell onto the clicked cell with animation, this custom cell contains some action and information about the clicked cell. This is actually like to FaceBook start page on the iphone. In Facebook program when the user click to plus icon on the left side of row on start page view, it's working but how.

Can someone provide me an example code or any suggestions ?

Thank you very much.

EDIT :

Guys let m开发者_Python百科e add more detail with some screenshots.

alt text http://img24.imageshack.us/img24/8159/img0398.png

As you can see on this picture, displaying list of data or some think like that. When the user press the talk balloon (with plus icon) on the right side or per row.

alt text http://img682.imageshack.us/img682/1726/img0399.png

Custom cell or view (whatever) is coming from leftside to onto the selected cell, with transition.

I think, my question was very clear now.

How can i do that ?


  1. To show plus button in the cell you must set table view's editing property to YES and implement delegate's editingStyleForRowAtIndexPath method - return UITableViewCellEditingStyleInsert for the cell you need.

  2. To add the new cell (with animation) to the table view you must implement

    • (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath

in your datasource - make necessary changes in your data source (the number of rows in table must be increased by one after this method) and call - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation for your tableview to animate changes.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜