1

除非更改设备方向,否则一切似乎都正常。每次更改时,都会调用以下方法:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                         duration:(NSTimeInterval)duration

问题是,无论我旋转设备多少次,主视图(self.view)的大小都不会改变为实际应该的大小。

2013-03-12 14:33:32.504 WBDEMO[888:907] {{0, 20}, {768, 1004}}
2013-03-12 14:33:33.929 WBDEMO[888:907] {{0, 0}, {748, 1024}}
2013-03-12 14:33:35.357 WBDEMO[888:907] {{0, 20}, {768, 1004}}
2013-03-12 14:33:36.009 WBDEMO[888:907] {{0, 0}, {748, 1024}}

在纵向模式下,尺寸应为 {768, 1004},而在横向模式下,尺寸应为 {1024, 748}

我尝试将其 autoresizingMask 设置为:

self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

但它仍然不起作用。有什么建议么?

记录代码:

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                         duration:(NSTimeInterval)duration
{
    NSLog(@"%@", NSStringFromCGRect(self.view.frame));
}
4

0 回答 0