loadNibNamed, view shifted up?
I am using loadView to programatically setup a UIViewController subclass and was wondering if I am getting it right. When I look at my "Interface.xib" in Interface Builder its view says 0,20,320,460 with the Status bar at the top. My question is when I build the application the view is shifted up (i.e. ignoring the Status bar). I am correcting this by setting the views frame, but am a littl开发者_高级运维e curious why its not coming in from the xib file?
- (void)loadView {
NSLog(@"HYBRID UI: %s", __PRETTY_FUNCTION__);
NSArray *nibArchive = [[NSBundle mainBundle] loadNibNamed:@"Interface" owner:self options:nil];
UIView *nibView = [nibArchive lastObject];
[nibView setFrame:[[UIScreen mainScreen] applicationFrame]];
[self setView: nibView];
}
cheers gary
Maybe the view, when loaded from main bundle, doesn't get it's bound in the superview context. Hence getting (x, y) = (0, 0).
You should try to move your view to whatever (x, y) in your xib and watch if this changes anything.
精彩评论