2010-09-17 19 views
1

基本上第二視圖應該從頂部我看到在子視圖的底部的間隙

我看到在子視圖的底部的間隙去20像素,我可以看到所述第一視圖的底部

Link to screen shot

有一些方法我可以設置頁邊距或邊界,以便視圖可以去爲20px下來

+1

20px間隙與狀態欄高度相同。你有沒有試過[___ setFrame:CGRectMake(0,0,__,__)]? – 2010-09-17 13:41:33

+0

這是我在代碼中提出的動畫,它的工作原理,但現在,正常的觀點(顯示一個30px更高),然後它下降30px。 [[settingsViewController視圖] setBounds:CGRectMake(0,-30,320,480)]在我顯示視圖之前,我應該在哪裏設置邊界代碼,以便用戶看不到視圖正在向下移動; – Spire 2010-09-20 07:36:05

+0

你能提供你用來顯示這個視圖的代碼嗎?我不認爲我們可以在不瞭解更多關於如何展示視圖的情況下回答您的問題。 – 2011-03-04 01:04:08

回答

0

這樣的解決將是

-(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; 
} 
相關問題