0

Is it possible to load a .xib file without loading it via self.view?

I have tried the following:

UINib *customNib = [UINib nibWithNibName:@"ViewControllerContact" bundle:nil];
ViewControllerContact *customView = [[customNib instantiateWithOwner:self options:nil] objectAtIndex:0];
[self.view addSubview:customView];

However, because the current class the code is executing doesn't have a view (it is just an NSObject) it wont launch the .xib.

Josh Boothe
  • 1,413
  • 4
  • 25
  • 40
  • 1
    See answers to this [question](http://stackoverflow.com/questions/15405916/correct-way-to-load-a-nib-for-a-uiview-subclass). Note that your nib should contain only the view without a view controller. It is unclear from your description whether the nib contains a view controller. – Lev Landau Aug 14 '14 at 13:30
  • A .xib file is just an archive of objects. What does "open a .xib" or "launch the .xib" mean? – newacct Aug 14 '14 at 20:42

0 Answers0