-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtension.swift
86 lines (69 loc) · 2.45 KB
/
Extension.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
//
// Spinner.swift
// Terms_of_Use_Scanner
//
// Created by Maya Rajan on 7/14/18.
// Copyright © 2018 Maya Rajan. All rights reserved.
//
import UIKit
extension UIViewController {
class func displaySpinner(onView : UIView) -> UIView {
//let spinnerView = UIView.init(frame: onView.bounds)
let spinnerView = UIView.init(frame: CGRect(origin: CGPoint(x: 0,y :0), size: CGSize(width: onView.frame.size.width, height: onView.frame.size.height)))
spinnerView.isUserInteractionEnabled = true
spinnerView.isUserInteractionEnabled = true
spinnerView.backgroundColor = UIColor.init(red: 0.5, green: 0.5, blue: 0.5, alpha: 0.5)
let ai = UIActivityIndicatorView.init(activityIndicatorStyle: .whiteLarge)
ai.isUserInteractionEnabled = true
ai.startAnimating()
ai.center = spinnerView.center
DispatchQueue.main.async {
spinnerView.addSubview(ai)
onView.addSubview(spinnerView)
}
return spinnerView
}
class func removeSpinner(spinner :UIView) {
DispatchQueue.main.async {
spinner.removeFromSuperview()
}
}
}
extension UITextView {
func increaseFontSize() {
self.font = UIFont(name: self.font!.fontName, size: self.font!.pointSize+1)!
}
func decreaseFontSize() {
self.font = UIFont(name: self.font!.fontName, size: self.font!.pointSize-1)!
}
func setFontSize(sizee : Float) {
self.font = UIFont(name: self.font!.fontName, size: CGFloat(sizee))!
}
}
extension UILabel {
func increaseFontSize() {
self.font = self.font.withSize(self.font.pointSize+1)
}
func decreaseFontSize() {
self.font = self.font.withSize(self.font.pointSize-1)
}
func setFontSize(sizee: Float) {
self.font = self.font.withSize(CGFloat(sizee))
}
}
extension UITextField {
func increaseFontSize() {
self.font = UIFont(name: self.font!.fontName, size: self.font!.pointSize+1)!
}
func decreaseFontSize() {
self.font = UIFont(name: self.font!.fontName, size: self.font!.pointSize-1)!
}
func setFontSize(sizee : Float) {
self.font = UIFont(name: self.font!.fontName, size: CGFloat(sizee))!
}
}
extension UIButton {
func setFontSize(sizee : Float) {
self.titleLabel?.setFontSize(sizee: sizee)
}
}