I see a gap at the bottom of the subview

Discussion in 'iOS Programming' started by spire.bt, Sep 17, 2010.

  1. spire.bt macrumors newbie

    Joined:
    Apr 8, 2010
    #1
    Basically the second view should go 20px from the top

    I see a gap at the bottom of the subview, I can see the bottom of the first view

    [​IMG]


    Is there some way I can set margins or boundaries so the view can go 20px down
     
  2. namanhams macrumors regular

    Joined:
    Jun 3, 2009
    #2
    How do you add that view ?

    Try this :

    Code:
    thatView.frame = [[UIScreen mainScreen] applicationFrame];
    
    'thatView' is the view you want to display.
     
  3. spire.bt thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #3

    Here is my code with the animation
    Code:
    -(void)CallingView2{
    SettingsViewController *aSettingsView = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
    	
    	[self setSettingsViewController:aSettingsView];
    	[aSettingsView release];
    	
    	[UIView beginAnimations:nil context:NULL];
    	[UIView setAnimationDuration:1.0];
    	//setting the animation
    	[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
    	[self.window addSubview:[settingsViewController view]];
    	[UIView commitAnimations];
    }
    
    this is in the app delegate and i call it form the first view with -(IBAction)

    Code:
    -(IBAction)Calling2{
    	
    	WebskiAppBetaAppDelegate *mainDelegate = (WebskiAppBetaAppDelegate *)[[UIApplication sharedApplication] delegate];
    	[mainDelegate CallingView2];	
    	
    }
    
    this is the IBAction that calls the view from the delegate
     
  4. namanhams macrumors regular

    Joined:
    Jun 3, 2009
    #4
    You try this :

    Code:
    settingsViewController.view.frame = [[UIScreen mainScreen] applicationFrame];
    
     
  5. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #5
    This comes from not using a navcontroller. If you use a navcontroller with a hidden nav bar these kinds of oddball errors will be taken care of by the navcontroller.
     
  6. spire.bt thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #6
    Code:
    -(void)CallingView2{
    SettingsViewController *aSettingsView = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
        
        [self setSettingsViewController:aSettingsView];
        [aSettingsView release];
        
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1.0];
        //setting the animation
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
        [self.window addSubview:[settingsViewController view]];
    [B]    [[settingsViewController view] setBounds:CGRectMake(0, -30, 320, 480)];
    [/B]
        [UIView commitAnimations];
    }

    I have put the code that is bold in the code where I commit my animation and it works, it moves the view as it should but now the problem is that when i rotate to the view i can see when the view is moving down.
    Is it possible to set bounds for the view before it is shown so the user cant see when it is moving 30px down every time he go to settings
     
  7. spire.bt thread starter macrumors newbie

    Joined:
    Apr 8, 2010
    #7
     

Share This Page