Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>well...</p> <pre><code>NSInteger styleRows = [rvc.scoreTypeArray objectAtIndex:indexPath.row]; </code></pre> <p>This is wrong because, you are trying to access indexPath.row which is not defined within this method. IndexPath.row is usually used within the tableView's methods like</p> <pre><code>(tableView*)didSelectRowAt:(NSIndexPath*)indexPath </code></pre> <p>So you will have to pass the value indexPath.row from the tableView's delegatemethods as a parameter in editDetails method.</p> <p>but you actually dont need this... instead do this:</p> <p>in <code>detailViewController</code> and <code>editViewController</code>, create a <code>NSString *dateObject</code> and make it of <code>@property(nonatomic,assign).</code> Now in your root viewcontroller's <code>didSelectRowAtIndexPath</code>, when the user taps the row,</p> <pre><code> [dvc setDateObject:self.dateArray objectAtindex:indexPath.row]; </code></pre> <p>so now, the <code>detailViewController</code> contains a reference to the original date in the dateObject. any change you make here will also change the date in the rootViewController's dateArray.</p> <p>So when the use taps the edit button, call the </p> <pre><code>-(IBAction)editDetails:(id)sender { editViewController *evc = [[editViewController alloc] initWithNibName:@"editViewController" bundle:nil]; UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:evc]; [evc setDateObject:self.dateObject]; [[self navigationController] presentModalViewController:navigationController animated:YES]; [navigationController release]; [evc release]; } </code></pre> <p>Now you've again passed on the original dateObject to the editViewController. in its viewDidLoad, set the textField, and when the user edits and hits done, replace the dateObject in editViewController with the modified dateObject. Remember,this is the original dateObject that was passed as a reference from rootViewController. so you've replaced it there as well in rootViewController's dateArray. now you just need to know when you return from detailViewController to rootViewController and do a [table reloadData];</p> <p>tadan!!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload