簡體   English   中英

如何旋轉時如何讓它淡入另一個視圖?

[英]How would I get it to fade to another view when rotated?

我知道如何讓視圖淡入,但我怎么看他們何時向左或向右旋轉屏幕?

您可以重新加載視圖,更改視圖,基本上可以在UIViewController的shouldAutoRotate方法中執行所需的任何操作:

(BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation

您可以在這里操縱任何喜歡的東西。 我有一個UIWebView,可以加載針對縱向或橫向優化的頁面,具體取決於此方法告訴我的方向。

至於淡入淡出,您可以使用UIViewAnimations

[UIView beginAnimations:nil context:NULL];
play with the alpha (1 is full display; 0 is total fade)
[UIView commitAnimations];

祝好運!

最好在willAnimateRotationToInterfaceOrientation:duration:方法中對界面旋轉中的視圖層次進行更改。 視圖控制器將從為旋轉動畫創建的動畫塊內部調用此方法。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM