Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
425 views
in Technique[技术] by (71.8m points)

xcode4 - Proper way to do "conditional segue" in iOS5

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...