Default update detailViewController, HELP.

Posted by DrBeak1 on Stack Overflow See other posts from Stack Overflow or by DrBeak1
Published on 2010-12-25T08:36:41Z Indexed on 2010/12/25 8:54 UTC
Read the original article Hit count: 256

Filed under:
|
|
|
|

I've created an app that allows users to add information (from an addViewController), which is then displayed in a UITableView on the rootViewController. When the user taps the tableViewCell the detailViewController then displays, you guessed it, more details regarding the inputted user information. What I'm trying to accomplish is to setup an editViewController that will allow users to edit information they've already submitted.

Currently, I'm trying to auto-populate the editViewController with the information that was previously submitted by the user (after which they can press save and update the info). However, I'm getting stuck trying to perform this auto-populating and I'm not sure this is even the best route to accomplish this.

Here is the edit method that is called to load the editViewController from the detailViewController.

-(IBAction)editDetails:(id)sender {

 editViewController *evc = [[editViewController alloc] initWithNibName:@"editViewController" bundle:nil];
 rootViewController *rvc = [[rootViewController alloc] init];

 UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:evc];

    [[self navigationController] presentModalViewController:navigationController animated:YES];
 ///For Style
 NSInteger styleCount = [[rvc scoreTypeArray] count];

 NSInteger styleRows = [rvc.scoreTypeArray objectAtIndex:indexPath.row]; ///HERE I GET AN ERROR MESSAGE SAYING THAT indexPath IS NOT DEFINED

 ///For Date
 NSInteger count = [[rvc dateArray] count];
 NSInteger rows = [[rvc indexPath] row]; ///AND HERE I GET A WARNING MESSAGE SAYING rootViewController MAY NOT RESPOND TO INDEX PATH, AND OF COURSE IT DOESN'T WORK

 [[evc dateField] setText:[NSString stringWithFormat:@"%@", [[evc dateArray] objectAtIndex:(count-1-rows)]]];


 [[evc styleField] setText:[NSString stringWithFormat:@"%@", [[rvc scoresArray] objectAtIndex:(styleCount-1-styleRows)]]];

    [navigationController release];

 [evc release];
 [rvc release];}

So here I'm trying to load the information from a saved array that is declared in my rootViewController.

Any thoughts any body? Please and thank you : )

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitableview