-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathViewController.swift
36 lines (28 loc) · 1013 Bytes
/
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
//
// ViewController.swift
// iOS10PushPop
//
// Created by seedante on 15/12/9.
// Copyright © 2015年 seedante. All rights reserved.
//
import UIKit
extension UIColor {
convenience init(red: Int, green: Int, blue: Int) {
assert(red >= 0 && red <= 255, "Invalid red component")
assert(green >= 0 && green <= 255, "Invalid green component")
assert(blue >= 0 && blue <= 255, "Invalid blue component")
self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: 1.0)
}
convenience init(netHex:Int) {
self.init(red:(netHex >> 16) & 0xff, green:(netHex >> 8) & 0xff, blue:netHex & 0xff)
}
}
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor(netHex: 0x007AFF)
}
@IBAction func pop(_ sender: AnyObject) {
_ = self.navigationController?.popViewController(animated: true)
}
}