I have a lot of controller
in my storyboard
and i am calling.
[self performSegueWithIdentifier:@"someIdentifier" sender:self];
If i want to search the controller
associate with someIdentifier
in xcode storyboard then how can i do?
Is there any way or i have to click and check on all the controller
?
Adding A Segue IdentifierSelect the segue by clicking on it. With the segue selected, navigate to the Attributes Inspector in the Utilities area. Set the Identifier field to displayNote .
Step 1: Set a Storyboard IDIn the Storyboard, select the view controller that you want to instantiate in code. Make sure the yellow circle is highlighted, and click on the Identity Inspector. Set the custom class as well as the field called "Storyboard ID". You can use the class name as the Storyboard ID.
To create a segue between view controllers in the same storyboard file, Control-click an appropriate element in the first view controller and drag to the target view controller. The starting point of a segue must be a view or object with a defined action, such as a control, bar button item, or gesture recognizer.
As suggest by Drux:
The best way i found is search Segue Identifier in the XML source code (Open As | Source Code) for the name of the viewcontroller and take it from there.
Unfortunately there's no way in code to find storyboard identifiers for a view controller / storyboard scene.
You could consider adding an additional target/build phase to your project that runs a script to extract the segue identifiers from the storyboard XML and convert into a file of constants you can import. Then you get runtime checking of the strings.
Something like this (for push segues):
grep -r -h "kind=\"push\"" *.storyboard | sed -e 's/.*identifier="\(.*\)".*id=\".*/extern NSString * const XXXSegueName_\1;/' | sort | uniq > "XXXSegueConstants.h"
grep -r -h "kind=\"push\"" *.storyboard | sed -e 's/.*identifier="\(.*\)".*id=\".*/NSString * const XXXSegueName_\1 = @\"\1\";/' | sort | uniq > "XXXSegueConstants.m"
should give you:
extern NSString * const HDCSegueName_PushMyViewController;
and
NSString * const HDCSegueName_PushMyViewController = @"PushMyViewController";
I'll leave other segue types as an exercise for the reader!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With