2012-06-02 28 views
0

我使用的幻燈片過渡,UIView的幻燈片切換,鑑於基於應用

通過使用此代碼,

 Home *lisnx = [[Home alloc] init]; 
     CATransition *animation = [CATransition animation]; 
     [self presentModalViewController:lisnx animated:NO]; 
     [animation setDuration:0.40]; 
     [animation setType:kCATransitionPush]; 
     [animation setSubtype:kCATransitionFromLeft]; 
     [[lisnx.view layer] addAnimation:animation forKey:@"SwitchToView1"]; 
     [lisnx release]; 

,但在橫向模式下,當我從一個視圖移動到另一個視圖的每一件事右移 景觀我已經使用這個代碼,

 self.view.bounds=CGRectMake(0.0,0.0,480.0,320.0); 
     scroll.frame=CGRectMake(0.0,0.0,480.0,320.0); 
     bgImg.frame=CGRectMake(0.0,0.0,480.0,320.0); 

如何從這個問題的出路請一些身體幫我。

+0

格式的代碼:)這是很難讀,否則 – self

回答

0

您需要爲每個視圖賦予不同的框架,以便縱向和橫向。

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; 

if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) { 
    scroll.frame=CGRectMake(0.0,0.0,480.0,320.0); 
    ...    
} 
else { 

scroll.frame=CGRectMake(0.0,200.0,200.0,320.0); 
... 
} 

給你在這裏框架,