2012-12-20 171 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