I'm developing a program based iPad. I created new modal UIViewController as formsheet mode not full screen. And to resize the view, i used following codes. ...
MyController* controller = [[MyController alloc] init];
controller.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController : controller animated: YES];
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if ( UIInterfaceOrientationIsPortrait(orientation) )
controller.view.superview.frame = CGRectMake(200, 100, 350, 600);
else
controller.view.superview.frame = CGRectMake(100, 200, 600, 350);
...
in MyController, i taked following codeds as didRotateFromInterfaceOrientation.
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if ( fromInterfaceOrientation == orientation )
return;
if ( UIInterfaceOrientationIsPortrait(orientation) )
{
self.view.frame = CGRectMake(0, 0, 350, 600);
self.view.superview.frame = CGRectMake(200, 100, 940, 628);
}
else
{
self.view.frame = CGRectMake(0, 0, 600, 350);
self.view.superview.frame = CGRectMake(100, 200, 600, 350);
}
}
but when rotate screen, the view don't be resized and width and height of superview has unexpect value. please help my problem.