我正在尝试展示SKStoreProductViewController
的实例,而不是动画。
来自视图控制器StoreKit的代码片段来自:
目标C
SKStoreProductViewController *storeProductVC = [[SKStoreProductViewController alloc] init];
[storeProductVC loadProductWithParameters: <PARAMETERS> completionBlock: nil];
[self presentViewController: storeProductVC animated: NO completion: nil];
夫特
let storeProductVC = SKStoreProductViewController()
storeProductVC.loadProduct(withParameters: <PARAMETERS>, completionBlock: nil)
self.present(storeProductVC, animated: false, completion: nil)
传递NO
animated
标志不起作用。 StoreKit视图控制器仍然显示动画。我知道Apple框架的主题是允许最少的自定义,但我希望情况并非如此。
答案 0 :(得分:1)
您可以在单独的UIWindow中显示没有动画的内容。
<强>目标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];
<强>夫特强>
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()