Iphone UIView幻灯片转换,在基于视图的应用程序中
我使用幻灯片转换 通过使用此代码Iphone UIView幻灯片转换,在基于视图的应用程序中,iphone,objective-c,ios,xcode,Iphone,Objective C,Ios,Xcode,我使用幻灯片转换 通过使用此代码 Home *lisnx = [[Home alloc] init]; CATransition *animation = [CATransition animation]; [self presentModalViewController:lisnx animated:NO]; [animation setDuration:0.40]; [animation setType:kCAT
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);
如何解决这个问题请一些人帮助我。你需要为每个视图提供不同的框架,包括纵向和横向
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);
...
}
在这里给出你的框架,格式化你的代码:)否则很难阅读