Proper way to do “conditional segue” in iOS5

谁说我不能喝 提交于 2019-11-27 20:33:20

问题


I'm trying to write really simple iOS5 app just searching for specific type of data.

It contains two screens, the user puts some data in the first, the app checks the data and if it is valid, the app will do a search and show result on new screen.

I'm completely new to iOS and storyboards, I read quite a few tutorials, but haven't been able to figure out how to do the checking of input and switching to new screen properly.

With iOS5 I guess I should use segue but that's all automatic. Even though I can put some code in prepareForSegue method, I couldn't find a way how to stop the segue from happening if the check fails, or am I trying to do it completely wrong?


回答1:


You can create "generic" segue by ctrl dragging from the viewController icon at the bottom to the destination. This segue won't be associated with any action. Then in your code where ever the event is using your conditional code that you want to trigger the segue call:

- (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender


来源:https://stackoverflow.com/questions/8581766/proper-way-to-do-conditional-segue-in-ios5

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