开发者

Is it possible to set bounds for the view before it is shown

-(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开发者_Go百科 time he go to settings


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜