Reputation: 30618
I have a nib call "Hello.xib", and I have a HelloView that is inherit from the UIView, and I want to do the layout in the Hello.xib, and I want to allocate them to the HelloView.m / HelloView.h, how can I do so? Thank you.
Upvotes: 0
Views: 1048
Reputation: 52237
Just today I wrote a demonstration code, that also uses instantiation of custom view by loading a nib
DetailContactHeaderView *headerView
headerView
and the View get Connectedin this controller I have this code
[[NSBundle mainBundle] loadNibNamed:@"DetailContactHeader" owner:self options:nil];
See my MyContacts for an implementation. FYI:
-tableView:viewForHeaderInSection:
Upvotes: 0
Reputation: 92384
You normally do so on the outside. In HelloView you should have a UIViewController derived class. Then when initializing it on the outside you would call:
hello = [[HelloViewController alloc] initWithNibName:@"Hello" bundle:nil];
The bundle:nil
make Cocoa use the default bundle.
Upvotes: 2
Reputation: 10475
In the interface builder's inspector for your Hello.xib's view, set the class of the view (in identity tab) to HelloView. I hope thats what you are looking for.
Upvotes: 0