priore

Loading the XIB dependent on the device

Jul 9th, 2014
809
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Loading the XIB dependent on the device
  2. //
  3. // 1. create your viewcontroller's named MyViewController~ipad.xib and MyViewController~iphone.xib
  4. //
  5. // 2. inizialize your class with MyViewController myvc = [[MyViewController alloc] initWithDefaultNib];
  6. //
  7.  
  8. - (id)initWithDefaultNib
  9. {
  10.     NSString *nibName =[[[[[NSBundle mainBundle] pathForResource: NSStringFromClass([self class]) ofType:@"nib"] componentsSeparatedByString:@"/"] lastObject] stringByReplacingOccurrencesOfString:@".nib" withString:@""];
  11.     if (self = [super initWithNibName:nibName bundle:nil]) {
  12.        
  13.     }
  14.    
  15.     return self;
  16. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×