有什麼方法可以在設備方向動畫完成之前執行代碼?設備方向將改變而不是已經改變
現在,我將自己作爲一個觀察者UIDeviceOrientationDidChangeNotification
不過,我需要我的代碼來完成實際改變後發生不前。
有什麼方法可以在設備方向動畫完成之前執行代碼?設備方向將改變而不是已經改變
現在,我將自己作爲一個觀察者UIDeviceOrientationDidChangeNotification
不過,我需要我的代碼來完成實際改變後發生不前。
檢查文檔:)
響應視圖旋轉活動 -
willRotateToInterfaceOrientation:時間:
willAnimateRotationToInterfaceOrientation:時間:
didRotateFromInterfaceOrientation:
試圖改變它在這個方法:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
我不使用一個UIViewController。這就是爲什麼我試圖給我們NSNotification中心 – Hackmodford
哦,對不起。然後我建議這個答案。 http://stackoverflow.com/questions/1160620/how-do-i-detect-the-iphone-orientation-before-rotating –
是的......我基本上做到了。並使用視圖setNeedsLayout。這樣我可以改變字段,它會更新顯示。 – Hackmodford