Push View Controllers from Modal View in Storyboard

无人久伴 提交于 2020-01-02 07:00:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!