iPhone addSubview overlays the whole view
I've created a .xib file and added a UIView to it in IB that I've called detailView
. I need to load a .xib into the detailView
area, and here is the code I'm using in my view controller to do so:
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"DetailView"
owner:self
options:nil];
UIVi开发者_开发技巧ew *nibView = [nibObjects objectAtIndex:0];
self.detailView = nibView;
A screenshot of the setup in IB is here: http://www.pict.com/view/2612170/0/screenshot20100123at2
The detailView .xib loads, but for some reason disregards the frame for the detailView area that was set up in IB and fills the whole screen. What gives???
Thanks!
If I see it right, the detailView outlet is already connected to PropertyEditViewController. You don't want to set self.detailView to nibView manually because you actually override the detailView with its parent view. Just send -loadNibNamed:owner:options: and you should be OK.
精彩评论