如何以编程方式将 UIActivityViewIndicator
置于 UITableViewCell
中?
最佳答案
在 UITableViewController
的自定义子类中尝试类似的操作:
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cellIdentifier = "LoadingCell"
var cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier) as UITableViewCell!
if cell == nil {
cell = UITableViewCell(style: .Default, reuseIdentifier: cellIdentifier)
let activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: .Gray)
activityIndicatorView.autoresizingMask = [.FlexibleLeftMargin, .FlexibleRightMargin, .FlexibleTopMargin, .FlexibleBottomMargin]
activityIndicatorView.center = cell.center
cell.contentView.addSubview(activityIndicatorView)
}
return cell
}
关于ios - 将 UIActivityViewIndicator 置于 UITableViewCell 的中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39307981/