问题
I am using storyboard and have a screen which is presented modally, which I then need to push other view controllers from so that I can select items for the modal view (similar to adding an entry on the iPhone Calendar app). So I am going from:
Navigation Controller > VC > Modal View Controller > ??? Here I want to push a VC so that I can select an item to return to the modal view.
How can I make this possible as I'm currently getting an error "Push segues can only be used when the source controller is managed by an instance of UINavigationController."
Ah ok, so I now have it setup like you said, I now get an error when trying to set a property on the view controller (I was using a push controller before) using the following:
SetTransactionDateViewController *stdvc = (SetTransactionDateViewController *)[segue destinationViewController];
// Get the day to pass to the select date controller
stdvc.transactionDate = [Utilities convertStringToDate:cellDate.detailTextLabel.text:FORMAT_DD_MMM_YYYY];
"[UINavigationController setTransactionDate:]: unrecognized selector sent to instance"
回答1:
When you allocate the view that you are presenting modally, you need to make sure that this view is embed inside of a UINavigationViewController
. Navigation Controllers are required in order for you to do segues like the one you described.
Your storyboard should look like so:
来源:https://stackoverflow.com/questions/14222810/push-view-controllers-from-modal-view-in-storyboard