I am trying to show a modalView on an iPad by reducing its width and height, but the problem is that it is not center-aligned. In iOS 6 it used to work fine, but in iOS 7 it is not center aligned.
Below is my code:
m_helpQA = [[HelpQAViewController alloc]init];
m_helpQA.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:m_helpQA animated:YES completion:NULL];
m_helpQA.view.superview.bounds = CGRectMake(0, 0, 350, 250);//Dimensions of ModalView.
presently I am getting it this way
For iOS 7 try this:
[self.navigationController presentViewController:navigationController animated:YES completion:^{
//Make the modal bigger than normal
navigationController.view.superview.bounds = CGRectMake(0, 0, 700, 650);
}];
The animation will look ugly so I would recommend adding an animation to improve it:
[self.navigationController presentViewController:navigationController animated:YES completion:^{
[UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{
//Make the modal bigger than normal
navigationController.view.superview.bounds = CGRectMake(0, 0, 700, 650);
} completion:^(BOOL finished) {
}];
}];
Also remember that you will need to set the frame of the navigationControllers view in the viewDidAppear for the content to be the correct size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With