Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the current storyboard name?

I want to know what is the current loaded storyboard,I used the below code but it is still get me the Main storyboard not the current.

//This get me the Main storyboard 
[[NSBundle mainBundle].infoDictionary objectForKey:@"UIMainStoryboardFile"];
like image 271
wod Avatar asked Jul 18 '13 12:07

wod


People also ask

What is storyboard name?

A storyboard ID does exactly what the name implies: it identifies. Just that it identifies a view controller in a storyboard file. It is how the storyboard knows which view controller is which.

How do you write a storyboard name?

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.

How do I find the storyboard ID in Swift?

To get the name of a storyboard, just go to your storyboard file, and don't click on any of the View Controllers. Open up the File Inspector, and on the first tab, at the top it will have your name (ie. "Main. storyboard").


1 Answers

Building on Durican's answer above:

Within a view controller:

UIStoryboard * storyboard = self.storyboard;
NSString * storyboardName = [storyboard valueForKey:@"name"];

(The name will not include the ".storyboard" filename extension.)

like image 83
Xiphias Avatar answered Oct 12 '22 10:10

Xiphias