View not aligned to the window?

Discussion in 'iOS Programming' started by Aranince, Sep 14, 2009.

  1. Aranince macrumors 65816

    Joined:
    Apr 18, 2007
    Location:
    California
    #1
    I have two .xib files. I got it to transition from the first nib to the second just fine, however on the second nib, the view isn't aligned properly. I have no idea why it is doing this. Any ideas?

    Here is where I show the view
    Code:
    - (void)showTextView {
    	TextViewController *aTextViewController = [[TextViewController alloc] initWithNibName:@"TextView" bundle: nil];
    	[self setTextViewController:aTextViewController];
    	[aTextViewController release];
    	
    	[UIView beginAnimations:nil context:NULL];
    	[UIView setAnimationDuration:1.0];
    	[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:window cache:NO];
    	[viewController.view removeFromSuperview];
    	[self.window addSubview:[textViewController view]];
    	[UIView commitAnimations];
    	
    }
     

    Attached Files:

  2. H2G2 macrumors newbie

    Joined:
    May 26, 2009
    #2
    Something like that may help :

    Code:
    CGRect frame = [[UIScreen mainScreen] applicationFrame]; 
    [MyControllerView SetFrame:frame];
    
    This will stick the view to the iPhone screen bounds.
    Of course, you could also define another frame using the CGRect struct if you don't want the view to fill the whole screen


    PS : since my Mac is out of order, I can't test, so there may be mistakes. But the general idea should be ok.
     
  3. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #3
    Yeah, looks like you would at least want:
    Code:
    [MyControllerView[B].view[/B] [B]s[/B]etFrame:frame];
    instead.
     
  4. Aranince thread starter macrumors 65816

    Joined:
    Apr 18, 2007
    Location:
    California

Share This Page