I've searched for similar questions for quite a while, most of which mentioned UIViewController's xib stuff. I tried to add a xib file for my custom viewController model,and found that its Xib’s File’s Owner should be my custom viewController model's class--that is reasonable. But why the situation differs when i create a xib for my UIView model-- an example as follows:
I create my UIView model which named "KWView"(KWView.h and KWView.m) then i create xib for this model, initializing it by
KWView *oneView = [[[NSBundle mainBundle] loadNibNamed:@"KWView" owner:nil options:nil ]lastObject];
This Xib’s File’s Owner name is “NSObject”(then i try any other more,whatever i choose, it runs smoothly),and there, i choose the view’s Custom Class as “KWView”[This xib named "KWView.xib"]
Questions are :
1.Whatever i change the Xib’s File’s Owner name of my custom view, it works. If so, what the work does this File’s Owner do here, or saying, why can this happen?
2.Generally, should i set the custom view's Xib’s File’s Owner to my custom view's class or the viewController's class which this view is going to be added to ? or just set it "NSObject"?