find xib for iPad
I load my xib files through: initWithNibName
programatically. If I set something like: [[LoginController alloc] initWithNibName:@"LoginController" bundle:nil];
Shouldn't it load LoginController.xib
if it is executed on iPhone and search for LoginController-iPad.xib
on the iPad? This is not h开发者_运维百科appening at my code, do I have to select the right one manually or is something going wrong?
Thanks in advance!
No, there is nothing in the documentation that suggests "-iPad
" is a valid resource-like modifier for initWithNibName:
, or that initWithNibName:
supports modifiers at all.
BTW, .xib
files are compiled to .nib
files by Xcode, so the application never sees a .xib
.
This is an old question, so perhaps this naming convention did not exist when @shaggy frog answered this question, but iOS should indeed load the iPad specific xib if it is named correctly. In this case your naming is slightly off, the correct naming scheme for an iPad specific xib is
NameOfYourViewController~ipad.xib
Note that it's a tilde (~) instead of a dash (-) and ipad is in lowercase.
精彩评论