-
Notifications
You must be signed in to change notification settings - Fork 0
/
Define.swift
65 lines (38 loc) · 1.06 KB
/
Define.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Define.swift
// Root
//
// Created by shifengwei on 14-6-4.
// Copyright (c) 2014年 shifengwei. All rights reserved.
//
// 7 以上
import UIKit
class Define:NSObject {
// 设备系统版本
func ifIOS7()->Bool{
let t = UIDevice.currentDevice()
let v = t.systemVersion
let arr:NSArray = v.componentsSeparatedByString(".")
let num : AnyObject! = arr[0]
let Num:CInt = num.intValue
if Num >= 7 {
return true
}else{
return false
}
}
// 获取设备的物理高度
func screenHeight()->CGFloat {
let main = UIScreen.mainScreen()
var rect = main.bounds
var height = rect.height
return height
}
// 获取设备的物理高度
func screenWidth()->CGFloat {
let main = UIScreen.mainScreen()
var rect = main.bounds
var width = rect.width
return width
}
}