Swift 如何在刷卡时增加进度条

Swift 如何在刷卡时增加进度条,swift,xcode,swipe,Swift,Xcode,Swipe,我在我的应用程序中有一个progressbar,下面我显示了mdel阵列中的卡,这些卡可以像tinder应用程序一样进行切换。因此,当我刷第一张卡时,进度条应随之增加,然后第二张卡的进度条应随之增加,依此类推现在您提到您正在使用ZLSwipeableViewSwift,在didEnd回调中,将进度条值设置为模型数组中显示的视图的计数 swipeableView.didEnd = {view, location in self.progressViewBar.progress = 1.0

我在我的应用程序中有一个progressbar,下面我显示了mdel阵列中的卡,这些卡可以像tinder应用程序一样进行切换。因此,当我刷第一张卡时,进度条应随之增加,然后第二张卡的进度条应随之增加,依此类推

现在您提到您正在使用ZLSwipeableViewSwift,在didEnd回调中,将进度条值设置为模型数组中显示的视图的计数

swipeableView.didEnd = {view, location in
    self.progressViewBar.progress = 1.0 * Float(self.swipeableView.numberOfActiveView) / Float(self.wordsData.count)
    print("Did end swiping view at location: \(location)")
}

不,我使用uiview作为显示卡片的子类,我使用了ZLSwipeableLibrary编辑了我的答案,从一开始就提到了这个库。我这样写的self.progressViewBar.progress=self.progressViewBar.progress*Float(self.swipableview.numberOfActiveView/uit(self.wordsData.count)),但它不起作用将progressViewBar作为输出在您的答案中,progressBar.value=progressBar.maximumValue*swipeableView.numberOfActiveView/modelArray.count、progressBar.value和progressBar.maximumValue不会显示