Pippo
Pippo

Reputation: 1473

Progress View not updating

Im trying to get a progress view working from within a progress block (parse) that returns a % complete.

when i print percent i get :

16.0
17.0
18.0
ect

so it is returning, and when i print progressBar.progress i get:

0.0
all the way to 
1.0

but still the progress bar does not update:

}, progressBlock: { (percent) in
   // print(Float(percent))
    DispatchQueue.main.async {
        cell.progressBar.setProgress(Float(percent/100), animated: true)
            //print(cell.progressBar.progress)
    }

//cell.progessBar.progress = Float(percent)

if percent == 100 {
    cell.progressBar.isHidden = true
}

})

note that cell is a custom cell defined thus:

func didDoubleTap(gesture: UITapGestureRecognizer) {

    let point: CGPoint = gesture.location(in: self.collectionView)

    if let selectedIndexPath: IndexPath = self.collectionView.indexPathForItem(at: point) {
        // let selectedCell: UICollectionViewCell = self.collectionView.cellForItem(at: selectedIndexPath as IndexPath)!
        // let indexItem = selectedIndexPath[1]
        // create instance of the cell so we can manipulate the images
        let cell: JourneyCollectionViewCell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: selectedIndexPath) as! JourneyCollectionViewCell

Upvotes: 0

Views: 617

Answers (1)

Pippo
Pippo

Reputation: 1473

You were heading in the right direction. problem with definition of cell.

use the index that was created without the refuse allows editing of cell.

let cell: JourneyCollectionViewCell = self.collectionView.cellForItem(at: selectedIndexPath ) as! JourneyCollectionViewCell

Upvotes: 1

Related Questions