@@ -10,22 +10,30 @@ import UIKit
10
10
11
11
class ViewController : UIViewController {
12
12
13
+ private lazy var button : UIButton = {
14
+ let _button = UIButton ( type: . System)
15
+ _button. setTitle ( " Show EZLoadingActivity " , forState: . Normal)
16
+ _button. addTarget ( self , action: Selector ( " showLoadingActivity: " ) , forControlEvents: . TouchUpInside)
17
+ return _button
18
+ } ( )
19
+
13
20
override func viewDidLoad( ) {
14
21
super. viewDidLoad ( )
15
- // Do any additional setup after loading the view, typically from a nib.
16
-
22
+ view. addSubview ( button)
23
+
24
+ if #available( iOS 9 . 0 , * ) {
25
+ button. translatesAutoresizingMaskIntoConstraints = false
26
+ button. centerXAnchor. constraintEqualToAnchor ( view. centerXAnchor) . active = true
27
+ button. centerYAnchor. constraintEqualToAnchor ( view. centerYAnchor) . active = true
28
+ } else {
29
+ button. sizeToFit ( )
30
+ button. center = CGPoint ( x: view. bounds. midX, y: view. bounds. midY)
31
+ button. autoresizingMask = [ . FlexibleTopMargin, . FlexibleLeftMargin, . FlexibleBottomMargin, . FlexibleRightMargin]
32
+ }
17
33
}
18
34
19
- override func viewDidAppear( animated: Bool ) {
20
- super. viewDidAppear ( animated)
35
+ @IBAction func showLoadingActivity( sender: UIButton ) {
21
36
EZLoadingActivity . showWithDelay ( " Testing.. " , disableUI: false , seconds: 3 )
22
-
23
- }
24
- override func didReceiveMemoryWarning( ) {
25
- super. didReceiveMemoryWarning ( )
26
- // Dispose of any resources that can be recreated.
27
37
}
28
38
29
-
30
39
}
31
-
0 commit comments