views:

67

answers:

1

Hi.

I have one UITableView with a custom cell loaded from a nib file, it works fine.

When I select a row(named CustomCell1), It is possible to load another CustomCell2 and replace CustomCell1 with it?

I guess I have to use didSelectRowAtIndexPath() but I don't know how.

Any ideas?

Thanks.

A: 

You can use set a "selected" iVar somewhere else, then reload the cell. if it's selected, load the selected nib. You are probably better off having both views in the same cell and swap them with a fade transition though.

Elfred
Thanks.Is easier using two views in the same nib but now I have a curiosity from another nib loading.Can you give me an example? I do not get it working. Everything you told me goes in didSelectRowAtIndexPath()?Sry for my english and for my noob question.
Pittor
well, the thought is that you would set the cell as selected somewhere in your view controller (say by having a selectedIndexPath ivar). Then you would call [tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; in didSelectRowAtIndexPath:. Then in cellForRowAtIndexPath: you'd do if([selectedIndexPath isEqual:indexPath]) { //load a nib} else { //load another nib}again, probably a bad idea.
Elfred
It works ;)Thank you very much.
Pittor