gpt4 book ai didi

swift - 如何使用 Swift 在 uitableViewCell 中启动 ActivityIndi​​cator 的动画?

转载 作者:可可西里 更新时间:2023-11-01 02:17:05 24 4
gpt4 key购买 nike

希望你一切都好。

我正在尝试在我的表格 View 的特定单元格上激活一个 UIActivityIndi​​cator。我想隐藏标签、图像、按钮并显示其他元素而不是。这些元素之一是 UIActivityIndi​​cator,它出现但没有动画 :(

这里使用的代码:

    func showProgressViewInCell(path: NSIndexPath) {
let cell = self.toursUITableView.cellForRowAtIndexPath(path) as! ToursTableViewCell;

// stop userInteraction
cell.userInteractionEnabled = false;

// hide elements
cell.downloadTourButton.hidden = true;
cell.descriptionLabel.hidden = true;
cell.typeOfTourLabel.hidden = true;
cell.typeOfTourImage.hidden = true;
cell.distanceOfTourLabel.hidden = true;
cell.distanceOfTourImage.hidden = true;
cell.durationOfTourLabel.hidden = true;
cell.durationOftourImage.hidden = true;
// show progressbar, percent, activityIndicator and updateLabel
cell.percentLabel.hidden = false;
cell.downloadTourProgressView.hidden = false;
cell.updateLabelProgressBar.hidden = false;
// downloadInProgressActivityIndicator uses option hides when stopped
cell.downloadInProgressActivityIndicator.hidden = false;
cell.downloadInProgressActivityIndicator.startAnimating();

// reload data of tableview
self.toursUITableView.beginUpdates();
self.toursUITableView.reloadData();
self.toursUITableView.endUpdates();
}

这里是我的 UIActivityIndi​​cator 的 InterfaceBuilder 上的配置:

configuration of UIActivityIndicatorView on Interface Builder

这对我不起作用:https://stackoverflow.com/a/29494991/6188918

预先感谢您的帮助。

最佳答案

前段时间我制作了一个在单元格内显示事件指示器的应用程序。我通过在数据源的 cellForRowAtIndexPath 方法中调用 startAnimating() 来做到这一点。试试这个。

关于swift - 如何使用 Swift 在 uitableViewCell 中启动 ActivityIndi​​cator 的动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36719741/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com