views:

671

answers:

1

Hi everyone, 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 me add more detail with some screenshots.

alt text

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

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 ?

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

Vladimir
Hi Vladimir, Thank you for your quick response, i think you missunderstand me, also i edited my question again with some screen shots. I hope i described to my question clearly. Thanks again
fyasar
Sorry, my answer is really not what you need
Vladimir
May be my solution is too straightforward and not the best one, but you can do this way:<br>In your custom cell create 2 subviews - the first (and the top) one with the info you display and the second one - with the buttons. When you tap the "plus" button you just change the 1st view frame to make it offscreen with animation effect (see "Animating views" section in UIView class reference).
Vladimir
Awesome, Thank you Vladimir.But I don't know that how can i take the selected row width, height (frame) information from tableView' selected cell ? I didn't find any solution about that.
fyasar