2012-12-20 170 views
1

我希望等待,直到iPad屏幕旋转完毕并且想要同时旋转并等待相同的功能。如果我没有添加几秒钟的等待时间,那么应用程序的行为并不像预期的那样。以下是功能:等待屏幕旋转

LandScapeRight = function() 
{ 
    return UIATarget.localTarget().setDeviceOrientation(UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT); 
} 

请建议。

回答

1

您要使用的delay()方法上UIATarget。该类的文档是here

快速和肮脏的方式,做你想做的延迟,像这样:

LandScapeRight = function() 
{ 
    var target = UIATarget.localTarget(); 
    target.setDeviceOrientation(UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT); 
    target.delay(1); // Delay is in seconds, can be a fraction 
} 
1

检查这两方法

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

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation