uiview - iOS addSubview of a new view controller does not work -


i trying -

- (void)viewdidload {   [super viewdidload];       thingviewcontroller *thingviewcontroller = [self thingcontrollerforcard:self.card];   thingviewcontroller.view.frame = cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height);   uiview *view = [thingviewcontroller view];   [self.view addsubview:view]; } 

it gives me white screen nothing in it. if push new view controller on navigation stack shows controller properly. idea might missing?

you should set thingviewcontroller frame on viewdidlayoutsubviews. viewdidload not has frames set correctly @ time:

- (void)viewdidload {     [super viewdidload];         thingviewcontroller *thingviewcontroller = [self thingcontrollerforcard:self.card];     uiview *view = [thingviewcontroller view];     [self.view addsubview:view]; }  - (void)viewdidlayoutsubviews {     [super viewdidlayoutsubviews];      thingviewcontroller.view.frame = cgrectmake(0, 0, self.view.frame.size.width, self.view.frame.size.height); } 

Comments