Yoda101B
Mar 17, 2009, 05:03 AM
Hi,
I'm trying to use a Modal view in landscape mode, but no matter what I try the position of the view is always way off centre, and I cannot move it... Any I ideas would be gratefully received....
In my mainViewController i use
- (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration {
CGRect apprect;
apprect.origin = CGPointMake(0.0f, 0.0f);
// adjust the frame size based on actual orientation
if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight))
apprect.size = CGSizeMake(480.0f, 300.0f);
else
apprect.size = CGSizeMake(320.0f, 460.0f);
// resize each subview accordingly
float offset = 32.0f;
for (UIView *subview in [self.view subviews]) {
CGRect frame = CGRectInset(apprect, offset, offset);
[subview setFrame:frame];
offset += 12.0f;
}
}
And then when I need the modalView I use
BuyFactoryViewController *buyFactoryViewController = [[BuyFactoryViewController alloc] initWithNibName:@"buyFactoryView" bundle:Nil];
[viewController presentModalViewController:buyFactoryViewController animated:YES];
Using this kind of code as no effect whatsoever
CGRect frame = buyFactoryView.frame;
frame.origin.x = -300;
frame.origin.y = -800;
buyFactoryView.frame = frame;
It's so silly but I've been scratching my head over this for ages....
Thanks in advance
Yoda,
(standing outside room 101, floor B)
I'm trying to use a Modal view in landscape mode, but no matter what I try the position of the view is always way off centre, and I cannot move it... Any I ideas would be gratefully received....
In my mainViewController i use
- (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration {
CGRect apprect;
apprect.origin = CGPointMake(0.0f, 0.0f);
// adjust the frame size based on actual orientation
if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation == UIInterfaceOrientationLandscapeRight))
apprect.size = CGSizeMake(480.0f, 300.0f);
else
apprect.size = CGSizeMake(320.0f, 460.0f);
// resize each subview accordingly
float offset = 32.0f;
for (UIView *subview in [self.view subviews]) {
CGRect frame = CGRectInset(apprect, offset, offset);
[subview setFrame:frame];
offset += 12.0f;
}
}
And then when I need the modalView I use
BuyFactoryViewController *buyFactoryViewController = [[BuyFactoryViewController alloc] initWithNibName:@"buyFactoryView" bundle:Nil];
[viewController presentModalViewController:buyFactoryViewController animated:YES];
Using this kind of code as no effect whatsoever
CGRect frame = buyFactoryView.frame;
frame.origin.x = -300;
frame.origin.y = -800;
buyFactoryView.frame = frame;
It's so silly but I've been scratching my head over this for ages....
Thanks in advance
Yoda,
(standing outside room 101, floor B)
