【发布时间】:2016-04-14 01:44:32
【问题描述】:
我目前有一个 tableView,其中一个单元格包含一个 webView。当 webView 加载时,我希望它显示一个活动指示器,但仅在该单元格中。目前,指示器显示但没有动画,当视频出现时,它不会隐藏并保持在视频的顶部。下面是 tableViewCell 的代码:
class VideoOnDetailCell: UITableViewCell {
@IBOutlet weak var videoDetail: UIWebView!
@IBOutlet weak var activityIndicator: UIActivityIndicatorView!
func webViewDidStartLoad(webView: UIWebView) {
activityIndicator.hidden = false
activityIndicator.startAnimating()
NSLog("The web view is starting to load")
}
func webViewDidFinishLoad(webView: UIWebView){
activityIndicator.hidden = true
activityIndicator.stopAnimating()
NSLog ("The web view has finished loading")
}
}
这里是 cellForRowAtIndexPath:
let cell = tableView.dequeueReusableCellWithIdentifier("videoDetail", forIndexPath: indexPath) as!
VideoOnDetailCell
cell.videoDetail.allowsInlineMediaPlayback = true
cell.videoDetail.loadHTMLString("<iframe width=\"\(cell.videoDetail.frame.width)\" height=\"\(200)\" src=\"\(videoURL[indexPath.row])/?&playsinline=1\" frameborder=\"0\" allowfullscreen></iframe>", baseURL: nil)
self.DetailTvTableView.rowHeight = 200
return cell
【问题讨论】:
标签: swift uitableview uiwebview uiactivityindicatorview