ios - NSValue(CMTime : ) in swift 3?

标签 ios swift cocoa-touch swift2 swift3

我有这个代码

  var times = [NSValue]()
        for time in timePoints {
            times.append(NSValue(CMTime : time))
        }

我得到一个错误,他们在 swift 3 中什么都不是 CMTime 我真的找不到 cm 时间的任何参数..

最佳答案

检查 the reference of NSValue .

init(time: CMTime)

使用 NSValue(time: time)


再来一个。如果你想将[CMTime]转换成[NSValue],你可以这样写:

let times = timePoints.map(NSValue.init(time:))

关于ios - NSValue(CMTime : ) in swift 3?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38669061/

相关文章:

ios - 使用 setRowHeight 函数设置 UITableView 单元格高度和 tableView : heightForRowAtIndexPath: function? 之间有什么区别

swift - 滚动时 UITableViewCell 上的阴影消失

ios - 等待异步操作在 Swift 中完成

ios - 读取文本文件的特定部分

ios - 我如何才能知道 AdMob 是否加载了广告?

iOS Swift Dequeued Reusable Cell 未显示

ios - 获取 UISwitch 状态 -Xamarin

ios - 未使用联合登录在 AWS Amplify 用户池中创建用户

swift - 空 CGContext

ios - 结合导航 Controller 和标签栏 Controller