Reputation: 3
I'm having a issue with trying to get a new viewcontroller to work. I have a UITableView
that gets loaded from plist
files. The first row will go to the detailviewcontroller
, but the next row will not and has a error. The error in the second controller is DetailViewController2
may not respond to "get steps from file". Any ideas?
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
[detailViewController getStepsFromFile:[files objectAtIndex:indexPath.row]];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
DetailViewController2 *detailViewController2 = [[DetailViewController2 alloc] initWithNibName:@"DetailViewController2" bundle:nil];
[detailViewController2 getStepsFromFile:[files objectAtIndex:indexPath.row]];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController2 animated:YES];
[detailViewController2 release];
Upvotes: 0
Views: 303
Reputation: 657
i m using this code for the navigation from the tabelview different two screen.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0)
{
DetailViewController *C = [[DetailViewController alloc]init];
[self.navigationController pushViewController:C animated:NO];
[c release];
}
else
{
DetailViewController1 *C = [[DetailViewController1 alloc]init];
[self.navigationController pushViewController:C animated:NO];
[C release];
}
Upvotes: 1
Reputation: 43330
Declare the method -getStepsFromFile
in the .h in order for it to be visible to any instances of the class.
EDIT: Try it without animation for the first one, then animate the second one like so:
[self.navigationController pushViewController: detailViewController animated: NO];
[self.navigationController pushViewController: detailViewController2 animated: YES];
Upvotes: 0