Dynamically load storyBoards
ios, objective-c, uistoryboard
Solution
Solved it. The problem was that once a storyBoard gets compiled the ressource extension isn't `.storyboard` but `.storyboardc`, same way that a `.xib` compiled file has the `.nib` extension.
Problem
I'm working on a storyBoard loading system and I need to check for the presence of a specific storyBoard. I made a function checking for it (given a specific StoryBoard name) : ``` (NSString *)ressourceNameForDevice:(NSString *)rootName extension:(NSString *)ext { NSString *retString = rootName; NSString *iPadString = [NSString stringWithFormat:@"%@-iPad", rootName]; NSString *iPhoneWideString = [NSString stringWithFormat:@"%@-wide", rootName]; if (IS_IPAD && (nil != [[NSBundle mainBundle] pathForResource:iPadString ofType:ext])) { retString = iPadString; } if (IS_IPHONE_WIDE && (nil != [[NSBundle mainBundle] pathForResource:iPhoneWideString ofType:ext])) { retString = iPhoneWideString; } return retString; } ``` I'm calling this function with `@"storyboard"` as extension argument. My probleme is that the function fails on `nil != [[NSBundle mainBundle] pathForResource:iPhoneWideString ofType:ext]`, even though the storyBoard IS present in my project and bundle, it doesn't get found. I guess I should give it another extension, I tried with `@"nib"` too but no more result. Anyone knows how to check that ?