Opening a ModalView from a ModalView
I have a SplitViewController with a list of clients, after selecting a client, I open a modalView containing all the information on top of it with the following code:
detailsForm *detView = [[[detailsForm alloc] setDict:[[self.curClientList objectAtIndex:indexPath.row] attributes]] autorelease];
[detView setModalPresentationStyle:UIModalPresentationPageSheet];
[detView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:detView animated:YES];
Then, there is a button "edit" on that controller that should open 1 more modalview. The button event has the following code:
NSLog(@"Edit button clicked");
editNewClient *editView = [[[editNewClient alloc] edit:YES setEditData:self.resultsDict] autorelease];
[editView setModalPresentationStyle:UIModalPresentationPageSheet];
[editView setModalTransitionStyle:UIModalTransitionStyleFlipHorizo开发者_如何学JAVAntal];
[self.splitViewController presentModalViewController:editView animated:YES];
And nothing happens. If I change the line
[self.splitViewController presentModalViewController:editView animated:YES];
to
[self presentModalViewController:editView animated:YES];
I get an exception:
-[detailsForm viewControllers]: unrecognized selector sent to instance 0x53882d0
What's wrong? Or am I forced to use delegates?
presentModalViewController only works if it is used from a ViewController. It is a UIViewController message. I don't think that your 'self' is a controller in this case. Which is why the selector doesn't recognize it. If I were you I would use the delegate to do this. I hope this helps.
精彩评论