呈现没有动画的 SKStoreProductViewController
Present SKStoreProductViewController with no animation
我正在尝试展示 SKStoreProductViewController
没有 动画的实例。
StoreKit 视图控制器的代码片段来自:
Objective-C
SKStoreProductViewController *storeProductVC = [[SKStoreProductViewController alloc] init];
[storeProductVC loadProductWithParameters: <PARAMETERS> completionBlock: nil];
[self presentViewController: storeProductVC animated: NO completion: nil];
Swift
let storeProductVC = SKStoreProductViewController()
storeProductVC.loadProduct(withParameters: <PARAMETERS>, completionBlock: nil)
self.present(storeProductVC, animated: false, completion: nil)
为 animated
标志传递 NO
无效。 StoreKit 视图控制器仍然呈现动画。我知道 Apple 框架的主题是允许最少的自定义,但我希望情况并非如此。
您可以在单独的 UIWindow 中不带动画地呈现它。
Objective-C
SKStoreProductViewController *storeProductVC = [[SKStoreProductViewController alloc] init];
[storeProductVC loadProductWithParameters: <PARAMETERS> completionBlock: nil];
UIScreen *mainScreen = [UIScreen mainScreen];
// Note: storeKitWindow should be strongly held, i.e. a property
self.storeKitWindow = [[UIWindow alloc] initWithFrame: mainScreen.bounds];
self.storeKitWindow.screen = mainScreen;
self.storeKitWindow.windowLevel = UIWindowLevelStatusBar;
self.storeKitWindow.rootViewController = storeProductVC;
[self.storeKitWindow makeKeyAndVisible];
Swift
let storeProductVC = SKStoreProductViewController()
storeProductVC.loadProduct(withParameters: [:], completionBlock: nil)
let mainScreen = UIScreen.main
// Note: storeKitWindow should be strongly held, i.e. a property
storeKitWindow = UIWindow(frame: mainScreen.bounds)
storeKitWindow.screen = mainScreen
storeKitWindow.windowLevel = UIWindowLevelStatusBar
storeKitWindow.rootViewController = storeProductVC
storeKitWindow.makeKeyAndVisible()
我正在尝试展示 SKStoreProductViewController
没有 动画的实例。
StoreKit 视图控制器的代码片段来自:
Objective-C
SKStoreProductViewController *storeProductVC = [[SKStoreProductViewController alloc] init];
[storeProductVC loadProductWithParameters: <PARAMETERS> completionBlock: nil];
[self presentViewController: storeProductVC animated: NO completion: nil];
Swift
let storeProductVC = SKStoreProductViewController()
storeProductVC.loadProduct(withParameters: <PARAMETERS>, completionBlock: nil)
self.present(storeProductVC, animated: false, completion: nil)
为 animated
标志传递 NO
无效。 StoreKit 视图控制器仍然呈现动画。我知道 Apple 框架的主题是允许最少的自定义,但我希望情况并非如此。
您可以在单独的 UIWindow 中不带动画地呈现它。
Objective-C
SKStoreProductViewController *storeProductVC = [[SKStoreProductViewController alloc] init];
[storeProductVC loadProductWithParameters: <PARAMETERS> completionBlock: nil];
UIScreen *mainScreen = [UIScreen mainScreen];
// Note: storeKitWindow should be strongly held, i.e. a property
self.storeKitWindow = [[UIWindow alloc] initWithFrame: mainScreen.bounds];
self.storeKitWindow.screen = mainScreen;
self.storeKitWindow.windowLevel = UIWindowLevelStatusBar;
self.storeKitWindow.rootViewController = storeProductVC;
[self.storeKitWindow makeKeyAndVisible];
Swift
let storeProductVC = SKStoreProductViewController()
storeProductVC.loadProduct(withParameters: [:], completionBlock: nil)
let mainScreen = UIScreen.main
// Note: storeKitWindow should be strongly held, i.e. a property
storeKitWindow = UIWindow(frame: mainScreen.bounds)
storeKitWindow.screen = mainScreen
storeKitWindow.windowLevel = UIWindowLevelStatusBar
storeKitWindow.rootViewController = storeProductVC
storeKitWindow.makeKeyAndVisible()