代码之家  ›  专栏  ›  技术社区  ›  Spire

我看到子视图底部有一个缺口

  •  1
  • Spire  · 技术社区  · 15 年前

    基本上,第二个视图应该从顶部变成20px

    Link to screen shot

    有没有什么方法可以设置边距或边界,使视图可以下降20像素

    1 回复  |  直到 15 年前
        1
  •  0
  •   Spire    14 年前

    所以解决办法是

    -(void)goTo2{
    
        //calling the .xib file and the SettingsViewController
        SettingsViewController *aSettingsView = [[SettingsViewController alloc] initWithNibName:@"Settings" bundle:nil];
        [self setSettingsViewController:aSettingsView];
        [aSettingsView release];
    
        [self.window addSubview:[settingsViewController view]];
        //moving the view 30px down
        [[settingsViewController view] setFrame:CGRectMake(0, 20, 320, 460)];
    
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1.0];
        //setting the animation
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
    
        [UIView commitAnimations];  
        [settingsViewController release];
        settingsViewController = nil;
    }