标签:end add ram copy uiview uiimage control fun anim
//
// ViewController.swift
// hustle-mode
//
// Created by dwang on 08/11/2017.
// Copyright ? 2017 dwang. All rights reserved.
//
import UIKit
import AVFoundation
class ViewController: UIViewController {
@IBOutlet weak var darkBlueBG: UIImageView!
@IBOutlet weak var powerBtn: UIButton!
@IBOutlet weak var cloudHolder: UIView!
@IBOutlet weak var rocket: UIImageView!
@IBOutlet weak var hustleLbl: UILabel!
@IBOutlet weak var onLbl: UILabel!
var player:AVAudioPlayer!
override func viewDidLoad() {
super.viewDidLoad()
let path = Bundle.main.path(forResource: "hustle-on", ofType: "mp3")!
let url = URL(fileURLWithPath:path)
do{
player = try AVAudioPlayer(contentsOf: url)
player.prepareToPlay()
}catch let error as NSError{
print(error.description)
}
// Do any additional setup after loading the view, typically from a nib.
}
@IBAction func powerBtnPressed(_ sender: Any) {
cloudHolder.isHidden = false
darkBlueBG.isHidden = true
powerBtn.isHidden = true
player.play()
UIView.animate(withDuration: 2.3, animations:{
self.rocket.frame = CGRect(x: 0, y: 20, width: 264, height: 324)
}){(finished) in
self.hustleLbl.isHidden = false
self.onLbl.isHidden = false
}
}
}
标签:end add ram copy uiview uiimage control fun anim
原文地址:http://www.cnblogs.com/systembighunter/p/7806205.html