3

在我iPad的基础应用程序中,单击按钮会初始化照片拍摄。

我正在背靠背拍摄五张照片。一旦我触摸按钮,我需要锁定当前方向,五张照片应该在这个特定方向上拍摄。

比如说,如果目前我处于横向模式,并且如果我触摸按钮,那么这五张照片应该是在这种横向模式下拍摄的。

我目前正在使用以下代码。

它有效,但对核心并不完美,存在滞后时间。只有在按下按钮几秒钟后,它才会被锁定。

// End notifying the orientation change
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];

// Begin notifying the orientation change
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];

您能否为此提出任何解决方案?

提前致谢

4

1 回答 1

2

覆盖 shouldAutorotate 方法(我在 iOS6 上测试它并且它有效):

- (BOOL)shouldAutorotate
{
    return !self.isLocked;
}

- (IBAction)buttonClicked:(id)sender
{
    self.isLocked = !self.isLocked;
}
@end
于 2012-09-25T08:10:16.713 回答