Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用AudioKit在UIView中绘制采样文件的波形_Ios_Swift_Waveform_Audiokit - Fatal编程技术网

Ios 使用AudioKit在UIView中绘制采样文件的波形

Ios 使用AudioKit在UIView中绘制采样文件的波形,ios,swift,waveform,audiokit,Ios,Swift,Waveform,Audiokit,我在Swift和AudioKit中迈出了第一步。我在操场上玩了一会儿。现在我试图在UIView中绘制一个样本的波形 我的代码不起作用。UIView保持空白 @IBOutlet weak var audioOutputPlot: EZAudioPlot! override func viewDidLoad() { super.viewDidLoad() let file = try! AKAudioFile(readFileName: "Sounds/drumloop_1.wa

我在Swift和AudioKit中迈出了第一步。我在操场上玩了一会儿。现在我试图在UIView中绘制一个样本的波形

我的代码不起作用。UIView保持空白

@IBOutlet weak var audioOutputPlot: EZAudioPlot!

override func viewDidLoad() {
    super.viewDidLoad()

    let file = try! AKAudioFile(readFileName: "Sounds/drumloop_1.wav")
    let player = try! AKAudioPlayer(file: file)
    let plot = AKNodeOutputPlot(player, frame: audioOutputPlot.bounds)
    plot.plotType = .buffer
    plot.shouldFill = true
    plot.shouldMirror = true
    plot.color = UIColor.blue

    audioOutputPlot.addSubview(plot)

}
我已经将@IBOutlet audioOutputPlot与界面生成器的UIView连接起来,并在其自定义类中编写了“EZAudioPlot”


谢谢你的帮助

我认为您已经从viewDidLoad中本地声明了文件、播放器和绘图,这些都被遗忘了