UIStoryboard's +storyboardWithName:bundle: method does not autoselect based on device

Number:rdar://12753707 Date Originated:Tue, 27 Nov 2012 00:04:01 GMT
Status:Open Resolved:
Product:iPhone SDK Product Version:6.0
Classification:Enhancement Reproducible:Always
26-Nov-2012 03:55 PM Daniel Weeks:
When in a view controller and loading a UIStoryboard from code the developer calls the UIStoryboard +storyboardWithName:bundle method passing in a file that is in a specific bundle (or nil for the default bundle). When on an iPad a different storyboard needs to be called than when on an iPhone or iPod touch. There is no way to have two files named with only a device specifier to differentiate them like UIImage has.

When loading a UIImage with +imageNamed: there can be two files: image~ipad.png and image~iphone.png. On an iPad +imageNamed: will rerturn image~ipad.png and on and iPhone image~iphone.png. This convenience is great for supporting Universal apps.

Steps to Reproduce:
Load a storyboard in code. The string specified in the +storyboardWithName:bundle: is the filename without the ".storyboard" extension.

Expected Results:
Files name MyStoryboard~ipad.storyboard and MyStoryboard~iphone.storyboard would be loaded correctly on the appropriate devices.

Actual Results:
The developer has to explicitly specify the name of the file, including the device specifier. For example rather than calling:

[UIStoryboard storyboardWithName:@"MyStoryboard" bundle:nil];

to get a device appropriate storyboard file if it exists the call must be:

[UIStoryboard storyboardWithName:@"MyStoryboard~ipad" bundle:nil];

This is less than convenient for maintaining clean code in a Universal application.

no regressions



Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!