Search code examples
iosios7uipickerviewuitoolbaruivewcontroller

redraw view off screen - contains picker view and tool bar


Im trying to draw/place a view (which contains a picker view and a toolbar offscreen). On launch the View is still on the screen despite changing its coordinates in viewDidLoad.

 self.pickerViewContainer.frame = CGRectMake(0, 722, 320, 207);

Im using the storyboard. I have created the view in the storyboard, visible in the view controller. I thought i could redraw it off screen as per coordinates above.


Solution

  • When you use Auto layout write your view's frame related code in viewDidLayoutSubviews
    Here is a solution

    -(void) viewDidLayoutSubviews
    {
    self.pickerViewContainer.frame = CGRectMake(0, 722, 320, 207);
    }