我想实现一个UIActivityIndicatorView,当用户在应用程序内购买时运行。出于某种原因,即使我已经制作了视图的子视图,UIActivityIndicatorView也没有显示出来。UIActivityIndicatorView没有显示
class RemoveAdsViewController: UIViewController {
@IBAction func btnAdRemoval(sender: UIButton) {
let buyProgress = UIActivityIndicatorView(activityIndicatorStyle: .White)
buyProgress.center = self.view.center
self.view.addSubview(buyProgress)
buyProgress.startAnimating()
print(buyProgress)
PFPurchase.buyProduct("", block: { (error:NSError?) -> Void in
if error != nil{
let alert = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
}
})
buyProgress.stopAnimating()
buyProgress.removeFromSuperview()
}
PFRestore:
restoreProgress.startAnimating()
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
PFPurchase.restore()
dispatch_async(dispatch_get_main_queue(), {
restoreProgress.stopAnimating()
})
})
查看所有的右边所示的相关问题 - >你应该检查那些。这个问题之前已经被询问和回答。 – rmaddy
@rmaddy我已经检查了他们,答案并没有解决我的问题,这就是为什么我发布我自己的问题。 – wxcoder