//
//  ViewController.swift
//  EZLoadingActivity
//
//  Created by Goktug Yilmaz on 22/11/15.
//  Copyright © 2015 Goktug Yilmaz. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    private lazy var button: UIButton = {
        let _button = UIButton(type: .System)
        _button.setTitle("Show EZLoadingActivity", forState: .Normal)
        _button.addTarget(self, action: Selector("showLoadingActivity:"), forControlEvents: .TouchUpInside)
        return _button
    }()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.addSubview(button)

        if #available(iOS 9.0, *) {
            button.translatesAutoresizingMaskIntoConstraints = false
            button.centerXAnchor.constraintEqualToAnchor(view.centerXAnchor).active = true
            button.centerYAnchor.constraintEqualToAnchor(view.centerYAnchor).active = true
        } else {
            button.sizeToFit()
            button.center = CGPoint(x: view.bounds.midX, y: view.bounds.midY)
            button.autoresizingMask = [.FlexibleTopMargin, .FlexibleLeftMargin, .FlexibleBottomMargin, .FlexibleRightMargin]
        }
    }

    @IBAction func showLoadingActivity(sender: UIButton) {
        EZLoadingActivity.showWithDelay("Testing..", disableUI: false, seconds: 3)
    }

}

//
//  ViewController.swift
//  EZLoadingActivity
//
//  Created by Goktug Yilmaz on 22/11/15.
//  Copyright © 2015 Goktug Yilmaz. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
    }

    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        EZLoadingActivity.showWithDelay("Testing..", disableUI: false, seconds: 3)

    }
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}


--- 
+++ 
@@ -10,22 +10,30 @@
 
 class ViewController: UIViewController {
 
+    private lazy var button: UIButton = {
+        let _button = UIButton(type: .System)
+        _button.setTitle("Show EZLoadingActivity", forState: .Normal)
+        _button.addTarget(self, action: Selector("showLoadingActivity:"), forControlEvents: .TouchUpInside)
+        return _button
+    }()
+
     override func viewDidLoad() {
         super.viewDidLoad()
-        // Do any additional setup after loading the view, typically from a nib.
-        
+        view.addSubview(button)
+
+        if #available(iOS 9.0, *) {
+            button.translatesAutoresizingMaskIntoConstraints = false
+            button.centerXAnchor.constraintEqualToAnchor(view.centerXAnchor).active = true
+            button.centerYAnchor.constraintEqualToAnchor(view.centerYAnchor).active = true
+        } else {
+            button.sizeToFit()
+            button.center = CGPoint(x: view.bounds.midX, y: view.bounds.midY)
+            button.autoresizingMask = [.FlexibleTopMargin, .FlexibleLeftMargin, .FlexibleBottomMargin, .FlexibleRightMargin]
+        }
     }
 
-    override func viewDidAppear(animated: Bool) {
-        super.viewDidAppear(animated)
+    @IBAction func showLoadingActivity(sender: UIButton) {
         EZLoadingActivity.showWithDelay("Testing..", disableUI: false, seconds: 3)
-
-    }
-    override func didReceiveMemoryWarning() {
-        super.didReceiveMemoryWarning()
-        // Dispose of any resources that can be recreated.
     }
 
-
 }
-
Add a button in the example project to show loading activity
