Pergunta

-(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]];
    **[[settingsViewController view] setBounds:CGRectMake(0, -30, 320, 480)];**

    [UIView commitAnimations];}

I have put the code between the stars 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

Foi útil?

Solução

Your problem is that you're setting the view bounds within an animation block. The view origin will animate from (0,0) to (0,-30) during the time it takes to perform the flip transition.

Setting your view geometry in the view controller's viewDidLoad would be a better approach.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top