风景模式调整大小

问题描述:

在开发应用程序以通过使用UIScrollView显示图像库时,图像之间的滑动可以在纵向模式下正常工作,但在更改为横向模式时,它会显示图像和下一图像的一部分。 如果我能得到一些解释如何解决这个问题,我会非常感激。风景模式调整大小

+0

你应该张贴一些代码... – sergio

+0

您需要调整宽度和高度与间距之间动态缩略图。这是一般概念,但正如@sergio所说,如果您需要更多帮助,您需要发布一些代码。 – Canopus

确保您的UIScrollView及其父视图具有正确的值UIViewAutoResizingautoResizesSubViews值。

然后监听设备方向的变化,并采取适当的措施(=重新滚动视图的子视图)

-(void)applicationDidFinishLaunching:(UIApplication *)application { 
    // ... other things 

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; 
    [[NSNotificationCenter defaultCenter] addObserver:self 
       selector:@selector(didRotate:) 
       name:@"UIDeviceOrientationDidChangeNotification" object:nil]; 
}; 

-(void)didRotate:(NSNotification *)notification { 
    UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation]; 

    if (orientation == UIDeviceOrientationLandscapeLeft) { 
     NSLog(@"Landscape Left!"); 
    } 
}