优化代码结构
This commit is contained in:
parent
9c99a90c84
commit
9cf3feb5e8
@ -285,37 +285,7 @@ class CCSpaceAlbumFilterPopView2: UIView {
|
|||||||
|
|
||||||
extension CCSpaceAlbumFilterPopView2:UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
|
extension CCSpaceAlbumFilterPopView2:UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
|
||||||
|
|
||||||
|
|
||||||
// MARK: - 把秒数转换成时分秒(00:00:00)格式
|
|
||||||
///
|
|
||||||
/// - Parameter second: 秒数
|
|
||||||
/// - Returns: String
|
|
||||||
func transToHourMinSec(second: Int) -> String {
|
|
||||||
let allTime: Int = second
|
|
||||||
var hours = 0
|
|
||||||
var minutes = 0
|
|
||||||
var seconds = 0
|
|
||||||
var hoursText = ""
|
|
||||||
var minutesText = ""
|
|
||||||
var secondsText = ""
|
|
||||||
|
|
||||||
hours = allTime / 3600
|
|
||||||
hoursText = hours > 9 ? "\(hours)" : "0\(hours)"
|
|
||||||
|
|
||||||
minutes = allTime % 3600 / 60
|
|
||||||
minutesText = minutes > 9 ? "\(minutes)" : "0\(minutes)"
|
|
||||||
|
|
||||||
seconds = allTime % 3600 % 60
|
|
||||||
secondsText = seconds > 9 ? "\(seconds)" : "0\(seconds)"
|
|
||||||
|
|
||||||
if hoursText == "00" {
|
|
||||||
return "\(minutesText):\(secondsText)"
|
|
||||||
}else{
|
|
||||||
return "\(hoursText):\(minutesText):\(secondsText)"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// MARK: - UICollectionViewDataSource
|
// MARK: - UICollectionViewDataSource
|
||||||
@ -339,8 +309,8 @@ extension CCSpaceAlbumFilterPopView2:UICollectionViewDataSource, UICollectionVie
|
|||||||
}else if model.assetType == .video {
|
}else if model.assetType == .video {
|
||||||
|
|
||||||
let time:Double = Double(model.itemAsset!.duration)
|
let time:Double = Double(model.itemAsset!.duration)
|
||||||
// let timeStr:String = ZZHHelper.formatVideoTime(second:Int(time))
|
let timeStr:String = ZZHHelper.formatVideoTime(second:Int(time))
|
||||||
let timeStr:String = self.transToHourMinSec(second:Int(time))
|
// let timeStr:String = self.transToHourMinSec(second:Int(time))
|
||||||
|
|
||||||
cell.frameCountLabel.isHidden = true
|
cell.frameCountLabel.isHidden = true
|
||||||
cell.timeLabel.isHidden = false
|
cell.timeLabel.isHidden = false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user