是否可以將應用程序範圍內的屬性設置爲iOS應用程序內轉換速度的兩倍?如何加速iOS轉換和遊戲?
1
A
回答
7
整個應用程序?
嘗試在視圖控制器的內容視圖的背景層上設置speed屬性。速度= 2將是雙倍速度。您可以在所有視圖控制器的viewDidLoad方法中設置它。
您可能也可以創建一個UIWindow的自定義子類,並使該窗口對象將其視圖圖層上的speed屬性設置爲像makeKeyWindow這樣的瓶頸方法中的2.0。您需要讓所有應用的UIWindow對象使用您的自定義類。我不得不做一些挖掘來弄清楚如何做到這一點。
3
蘋果沒有簡單的方法來改變它,因爲它會使不同應用程序之間的轉換過於異構。您可以將圖層的速度加倍,但這會影響其他動畫的時間。最好的方法是使用UIViewControler上的類別實現自己的轉換。
的UIViewController + ShowModalFromView.h
#import <Foundation/Foundation.h>
#import <QuartzCore/QuartzCore.h>
@interface UIViewController (ShowModalFromView)
- (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view;
@end
的UIViewController + ShowModalFromView.m
#import "UIViewController+ShowModalFromView.h"
@implementation UIViewController (ShowModalFromView)
- (void)presentModalViewController:(UIViewController *)modalViewController fromView:(UIView *)view {
modalViewController.modalPresentationStyle = UIModalPresentationFormSheet;
// Add the modal viewController but don't animate it. We will handle the animation manually
[self presentModalViewController:modalViewController animated:NO];
// Remove the shadow. It causes weird artifacts while animating the view.
CGColorRef originalShadowColor = modalViewController.view.superview.layer.shadowColor;
modalViewController.view.superview.layer.shadowColor = [[UIColor clearColor] CGColor];
// Save the original size of the viewController's view
CGRect originalFrame = modalViewController.view.superview.frame;
// Set the frame to the one of the view we want to animate from
modalViewController.view.superview.frame = view.frame;
// Begin animation
[UIView animateWithDuration:1.0f
animations:^{
// Set the original frame back
modalViewController.view.superview.frame = originalFrame;
}
completion:^(BOOL finished) {
// Set the original shadow color back after the animation has finished
modalViewController.view.superview.layer.shadowColor = originalShadowColor;
}];
}
@end
這可以很容易地改變使用任何你想要的動畫過渡。希望這可以幫助!
相關問題
- 1. CCUserDefault,ios/android遊戲和遊戲更新
- 2. 如何將多場景遊戲轉換爲單場景遊戲?
- 3. Android加速度計遊戲
- 4. 如何動態決定轉換到哪個屏幕(iOS遊戲)
- 5. Libgdx遊戲加速並每秒減速
- 6. 如何設置iOS遊戲?
- 7. Android的帆布遊戲,遊戲速度
- 8. 將遊戲實現爲快速遊戲
- 9. 如何將轉換效果添加到我的LibGdx遊戲中?
- 10. 如何跳轉j2me遊戲?
- 11. Android遊戲循環,如何控制速度和幀速
- 12. Flash遊戲減速
- 13. iOS加速度計遊戲的錄製畫面
- 14. 如何在每增加50分後加速Sprite Kit遊戲
- 15. 如何保存遊戲數據爲我的iOS的Cocos2D遊戲?
- 16. 問題如何提高遊戲速度
- 17. iOS遊戲中心遊戲不同步
- 18. Android中的鎖屏加速遊戲
- 19. 在Xcode加速計時器遊戲
- 20. 加速器F#中的生活遊戲
- 21. unity3D賽車遊戲加速場,c#
- 22. 如何加快HTML5遊戲
- 23. 將Flash AS3遊戲轉換爲HTML5遊戲
- 24. 轉換簡單的Java遊戲中的安卓遊戲到Facebook
- 25. ios的硬件加速css3轉換
- 26. 遊戲遊戲和繼承
- 27. iOS遊戲和Facebook遊戲:相同的應用程序ID?
- 28. Sprite Kit遊戲在tvOS 9.1和iOS 9.2上游戲崩潰
- 29. Google Play遊戲服務多人遊戲iOS和Android
- 30. ios基於遊戲中心的遊戲調試和開發
子類'UIWindow'沒有必要。您可以在創建窗口後立即在應用程序委託中執行'self.window.layer.speed = 2.0f'。 – Costique 2012-04-04 20:51:12