-1

i need help. When my tableView's cell is selected, i want the cell to go to a page of its own, i don't want every cell to go to the same page. I tried using :

FirstFolderViewController * first = [[FirstFolderViewController alloc]init];
first.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[first presentModalViewController:first animated:YES];
[first release];

i added this to the didSelectRowAtIndexPath: method. but it won't work any idea?? Thanks

1 Answer 1

2

First off, albertamg's answer points out an important concept; the presentModalViewController should be called on self.

Second, it sounds like you need to have something unique happen in each subsequent view that you present, presumably based on data that creates your table cell. One way to do this is to set a @property on your FirstFolderViewController, just before you present it, and then when it's viewWillAppear function, is called, you can act on that value.

For example,

FirstFolderViewController * first = [[FirstFolderViewController alloc]init];
first.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

first.folderNumber = indexPath.row; // Added

[self presentModalViewController:first animated:YES];
[first release];

...assuming you're calling this inside your - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath method, and you've set up a property called folderNumber inside your FirstFolderViewController.

1
  • sure man good luck! if you haven't already, the stanford ios lectures (free on itunes) are a giant help.
    – Chazbot
    Jul 29, 2011 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.