I have a table. When you click on row of table you get detail using prepare for segue. From detail page, I have an edit button that lets you open a view controller previously created in the storyboard modally.
The question is how can I pass the row of the detail item or otherwise give the edit controller the info of what item to display?
Here is code that launches view controller.
//create Edit navigation button:
UIBarButtonItem *editButton = [[UIBarButtonItem alloc]
initWithTitle:@"Edit"
style:UIBarButtonItemStylePlain
target:self
action:
//next line calls method editView
@selector(editView:)];
self.navigationItem.rightBarButtonItem = editButton;
//method that fires when you click button to launch edit view controller
- (void) editView:(id) sender
{
NSLog(@"pressed");
UIStoryboard *storyBoard = self.storyboard;
NSString * storyboardName = [storyBoard valueForKey:@"name"];
UIViewController *vc = [[UIStoryboard storyboardWithName:storyboardName bundle:nil] instantiateViewControllerWithIdentifier:@"editvc"];
IDEditVC *secondViewController =
[storyBoard instantiateViewControllerWithIdentifier:@"editvc"];
}
But how can I pass the information on the item to edit?
Thanks for any suggestions.