PFQuery具有实时进度

时间:2016-04-25 07:28:26

标签: ios xcode swift pfquery

使用此查询时,如何显示实时进度值? 我可以只阻止一个百分点吗?我该如何实现这样的呢?

func queryStory(){
        self.userFile.removeAll()
        self.objID.removeAll()
        self.createdAt.removeAll()

        let query = PFQuery(className: "myClass")
        query.whereKey("isPending", equalTo: false)
        query.orderByDescending("createdAt")

        query.findObjectsInBackgroundWithBlock { (posts: [PFObject]?, error: NSError?) -> Void in
            if (error == nil){
                // Success fetching objects

                print("Post count:", posts!.count)

                for post in posts! {

                    if let imagefile = post["userFile"] as? PFFile {
                        self.userFile.append(post["userFile"] as! PFFile)
                        self.objID.append(post.objectId!)
                        self.createdAt.append(post.createdAt!)
                    }
                }

                dispatch_async(dispatch_get_main_queue()) {
                    self.collectionView.reloadSections(NSIndexSet(index: 0))
                    if (self.refreshControlSpin == true){
                        self.refreshControlSpin = false
                        self.refreshControl.endRefreshing()
                    }
                }

                print("Uploaded files count: ", self.userFile.count)
            }
            else{
                print(error)
            }
        }
    }

显示从0到100的百分比值,并更改实时。

0 个答案:

没有答案