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?
Asked
Active
Viewed 59 times
0

sam18
- 631
- 1
- 10
- 24
-
Your question isn't clear, please add screenshots. – gran33 May 08 '14 at 12:00
-
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 May 08 '14 at 13:13
1 Answers
0
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];
}

Austin
- 5,625
- 1
- 29
- 43