1

您好,我一直在尝试通过使用百分比计算不同组件的高度和宽度来为所有方向编写一个代码。我在纵向时得到 320 x 460 帧,这没问题,但是当我更改为横向模式时出现问题,即使现在我得到相同的尺寸,但实际上我应该得到 460 x 320。

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{


    NSLog(@"%f-%f",self.view.frame.size.width,self.view.frame.size.height);
}

我也尝试了其他功能但仍然没有成功

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{


 NSLog(@"%f-%f",self.view.frame.size.width,self.view.frame.size.height);

}
4

0 回答 0