presentModalViewController problem

Discussion in 'iOS Programming' started by Yoda101B, Mar 17, 2009.

  1. Yoda101B macrumors newbie

    Joined:
    Mar 7, 2009
    #1
    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

    Code:
    - (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

    Code:
    	BuyFactoryViewController *buyFactoryViewController = [[BuyFactoryViewController alloc] initWithNibName:@"buyFactoryView" bundle:Nil];
    	[viewController presentModalViewController:buyFactoryViewController animated:YES];
    Using this kind of code as no effect whatsoever

    Code:
    	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)
     
  2. nielshoven macrumors newbie

    Joined:
    Aug 2, 2009
    #2
    I'm having the same problem and it's driving me crazy! Did you ever find a solution? It seems to be something specific to 3.0. Perhaps a bug?
     

Share This Page