It looks like you are moving the view of the view controllers after centering it. Probably in didMoveToParentViewController:
Move the centering code to the end of the selectRoutine: method selectRoutine:
- (IBAction)selectRoutine:(id)sender { UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Storyboard" bundle:nil]; createRoutinePopupViewController* popupController = [storyboard instantiateViewControllerWithIdentifier:@"createRoutinePopupView"]; [self addChildViewController:popupController]; [self.view addSubview:popupController.view]; [popupController didMoveToParentViewController:self];
Or better yet, move it to didMoveToParentViewController:
- (void)didMoveToParentViewController:(UIViewController *)parent {
You may need to modify this code a bit. But I'm sure that your problem is incorrect (in time) the placement of the centering code, which is subsequently redefined by some other positioning of the position.
source share