【发布时间】:2016-09-21 06:57:20
【问题描述】:
我有表格视图,在每个可重复使用的单元格中都有一个进度条,现在的问题是如果触摸按钮,我如何暂停和播放进度及其动画。
var arr = [10 , 20 , 30 , 40]
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let tablecell:TableViewCell = tableView.dequeueReusableCellWithIdentifier("cell") as! TableViewCell
tablecell.tableImage.image = images[indexPath.row]
tablecell.tabelLabel.text = nameUrl[indexPath.row]
let count: Float = Float(arr[indexPath.row])
if flag == false{
tablecell.prog_bar.setProgress(count, animated: true)
} else {
tablecell.prog_bar.setProgress(0, animated: false)
tableView.reloadData()
}
return tablecell
}
【问题讨论】:
-
不要在
cellForRow:中使用tableView.reloadData()。 -
使用委托获取按下按钮的单元格
indexpath。有关更多信息,请参阅此帖子:stackoverflow.com/questions/39585638/… -
使用来自 Github 的滑块库。
-
好的,现在我知道如何为每个单元格中的按钮添加操作,但是如何暂停或恢复进度条
标签: ios swift progress-bar