views:

15

answers:

1

I need to hide a detail view that is shown when clicked on a tableviewitem

- (IBAction)done:(id)sender {
    [self.delegate OrderDetailsViewDidFinish:self];
}

It is all connected up with in the, xib and .h but the view doesnot close, it is loaded via this code and loads great:

    //Initialize the detail view controller and display it.
OrderDetailsView *dvController = [[OrderDetailsView alloc] initWithNibName:@"OrderDetailsView" bundle:[NSBundle mainBundle]];
dvController.selectedOrder = (@"%@",selectedOrder);
[self presentModalViewController:dvController animated:YES];
[dvController release];
dvController = nil;

the trouble comes when closing it, please not i ahve all the correct .h in the detail view

Thanks

Mason

A: 

If you present a controller as a modalViewController then when hiding it you only need this:

- (IBAction)done:(id)sender {
    [self.parentViewController dismissModalViewControllerAnimated:YES];
}

When you use modals a Parent-Child relation is created between two controller (the newly presented is the child) so you can call the previous controller with self.parentViewController from this new controller ;)

nacho4d