I have developed a custom UIView
with nib
file such that I can reuse it whenever needed. Now the thing is I have a nib
of a UIViewController
and I am drag and drop a Dummy UIView inside it and changing the Class Name
to custom view's class name. This works fine when I run my application. I can see the Custom View in my screen on runtime. But I can not see it in Interface builder. So, my question is, is it possible to see the custom view's layout in view controller's nib through interface builder?
0
votes
Your question isn't clear, please add screenshots.
– gran33
Unfortunately, Xcode doesn't provide such feature yet (at least not without 3rd party plugins which you can look for). Fortunately, it makes nibs processing much faster (performance-wise).
– A-Live
1 Answers
0
votes
You can't load a nib from inside another nib.
You could get around this by leaving the view in your view controller's nib as a placeholder, then loading the custom view's nib in viewDidLoad
:
- (void)viewDidLoad {
[super viewDidLoad];
UINib *customViewNib = [UINib nibWithNibName:@"CustomView" bundle:nil];
CustomView *customView = [[customViewNib instantiateWithOwner:self options:nil] objectAtIndex:0]
customView.frame = self.placeholderView.bounds;
[self.placeholderView addSubView:customView];
}