-
Notifications
You must be signed in to change notification settings - Fork 24
/
ViewController.swift
47 lines (36 loc) · 1.31 KB
/
ViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// ViewController.swift
// YXWaveViewDemo
//
// Created by YourtionGuo on 8/26/16.
// Copyright © 2016 Yourtion. All rights reserved.
//
import UIKit
import YXWaveView
class ViewController: UIViewController {
fileprivate var waterView: YXWaveView?
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Init Avatar OverView
let avatarFrame = CGRect(x: 0, y: 0, width: 60, height: 60)
let avatarView = UIImageView(frame: avatarFrame)
avatarView.layer.cornerRadius = avatarView.bounds.height/2
avatarView.layer.masksToBounds = true
avatarView.layer.borderColor = UIColor.white.cgColor
avatarView.layer.borderWidth = 3
avatarView.layer.contents = UIImage(named: "yourtion")?.cgImage
let frame = CGRect(x: 0, y: 0, width: self.view.bounds.size.width, height: 200)
waterView = YXWaveView(frame: frame, color: UIColor.white)
waterView!.addOverView(avatarView)
waterView!.backgroundColor = UIColor(red: 248/255, green: 64/255, blue: 87/255, alpha: 1)
// Add WaveView
self.view.addSubview(waterView!)
// Start wave
waterView!.start()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}