无法为按钮设置动画

时间:2018-03-18 09:03:32

标签: ios swift xcode swift4 xcode9

我有一些问题动画按钮​​“StartButton”,它没有脉动。

import UIKit
import AVKit
import AVFoundation

class ViewController: UIViewController {

@IBOutlet var StartButton: UIButton!


override func viewDidLoad() {
    super.viewDidLoad()

    playVideo()
    self.StartButton.pulsate()
    DispatchQueue.main.asyncAfter(deadline: .now() + 6.3) {
        self.dismiss(animated: true, completion: nil)
    }

每当我删除“playVideo()”功能时,一切都恢复正常,按钮再次开始脉动。我怎样才能解决这个问题? 这是“playVideo()”的代码

if let path = Bundle.main.path(forResource: "My Movie 1", ofType: "mp4")
    {
        let player = AVPlayer(url: URL(fileURLWithPath: path))
        let playerController = AVPlayerViewController()
        playerController.player = player

        present(playerController, animated: true, completion: {
            player.play()
        })
        playerController.showsPlaybackControls = false
    }

0 个答案:

没有答案