For a synch screen I made a ModalViewController on ios5. I used this code:
synchViewController = [[SynchViewController alloc] initWithNibName:@"SynchViewController" bundle:nil];
synchViewController.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:synchViewController animated:YES];
synchViewController.view.superview.frame = CGRectMake(0,0,SYNCHVIEW_WIDTH,SYNCHVIEW_HEIGHT);
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGPoint center = CGPointMake(CGRectGetMidX(screenBounds), CGRectGetMidY(screenBounds));
synchViewController.view.superview.center = CGPointMake(center.y, center.x);
The controller was designed in the xib file. This code worked.
Now under ios6 the presentModalViewController is depreciated. I changed the method, but now the modal view controller is totally displaced and got a wrong size.
How can I just have something like the iMessage login screen with the size of my designed xib layout?
EDIT: It works with this code: synchViewController = [[SynchViewController alloc] initWithNibName:@"SynchViewController" bundle:nil];
synchViewController.modalPresentationStyle = UIModalPresentationFormSheet;
synchViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:synchViewController animated:YES completion:nil];
synchViewController.view.superview.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
synchViewController.view.superview.frame = CGRectMake(0,0,
SYNCHVIEW_WIDTH,// Width
SYNCHVIEW_HEIGHT// Height
);
synchViewController.view.superview.bounds = CGRectMake(0, 0, SYNCHVIEW_WIDTH, SYNCHVIEW_HEIGHT);
CGRect screenBounds = [[UIScreen mainScreen] bounds];
CGPoint center = CGPointMake(CGRectGetMidX(screenBounds), CGRectGetMidY(screenBounds));
synchViewController.view.superview.center = CGPointMake(center.y, center.x);
But only if I set animated to YES. When im trying to load it without an animation, its totally displaced again, why?