我有一个带有 UIImage 视图的视图控制器,它根据方向加载不同的 .png。它加载了两个图像,但是 1)横向视图被压缩并且没有正确缩放,以及 2)当我在模拟器中运行它并将它向右转动两次(命令 + ->)它再次垂直并且应该显示纵向图像,但它会横向显示横向图像。有任何想法吗?我的 .m 方法如下:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
if((self.interfaceOrientation == UIDeviceOrientationLandscapeLeft) || (self.interfaceOrientation == UIDeviceOrientationLandscapeRight))
{
_image1.image = [UIImage imageNamed:@"Landscape.png"];
}
else if((self.interfaceOrientation == UIDeviceOrientationPortrait) || (self.interfaceOrientation == UIDeviceOrientationPortraitUpsideDown))
{
_image1.image = [UIImage imageNamed:@"Portrait.png"];
}
}
我还缺少更多方向吗?有没有办法让肖像照原样(“缩放填充”)但以某种方式让风景也正确出现?值得一提的是,风景在 iOS6 上正常显示,但现在在 iOS7 上的缩放比例很差。iOS6 中也存在两个旋转 = 横向横向的问题。谢谢。