Skip to content

Commit 3e048dc

Browse files
committed
Demo added
1 parent b166395 commit 3e048dc

File tree

2 files changed

+109
-16
lines changed

2 files changed

+109
-16
lines changed

AASquaresLoadingDemo/AASquaresLoadingDemo/Base.lproj/Main.storyboard

+53
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<dependencies>
44
<deployment identifier="iOS"/>
55
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
6+
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
67
</dependencies>
78
<scenes>
89
<!--View Controller-->
@@ -16,8 +17,60 @@
1617
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
1718
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
1819
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
20+
<subviews>
21+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="vYq-Ws-PIM" userLabel="Bottom left">
22+
<rect key="frame" x="0.0" y="300" width="150" height="300"/>
23+
<color key="backgroundColor" red="1" green="0.50196081399917603" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
24+
</view>
25+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="D7O-6K-Gkp" userLabel="Bottom center">
26+
<rect key="frame" x="150" y="300" width="300" height="300"/>
27+
<color key="backgroundColor" red="0.80000001192092896" green="1" blue="0.40000000596046448" alpha="1" colorSpace="calibratedRGB"/>
28+
</view>
29+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5sG-Ud-Ubd" userLabel="Bottom right">
30+
<rect key="frame" x="450" y="300" width="150" height="300"/>
31+
<color key="backgroundColor" red="0.0" green="0.25098040699958801" blue="0.50196081399917603" alpha="1" colorSpace="calibratedRGB"/>
32+
</view>
33+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jFI-G7-9uA" userLabel="Top left" customClass="AASquaresLoading" customModule="AASquaresLoading">
34+
<rect key="frame" x="0.0" y="0.0" width="300" height="300"/>
35+
<color key="backgroundColor" red="0.0" green="0.50196081399917603" blue="1" alpha="1" colorSpace="calibratedRGB"/>
36+
</view>
37+
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gOY-DI-0UP" userLabel="Top right">
38+
<rect key="frame" x="300" y="0.0" width="300" height="300"/>
39+
<color key="backgroundColor" red="0.40000000596046448" green="1" blue="0.40000000596046448" alpha="1" colorSpace="calibratedRGB"/>
40+
</view>
41+
</subviews>
1942
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
43+
<constraints>
44+
<constraint firstItem="gOY-DI-0UP" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.5" id="0r3-Cc-Z1C"/>
45+
<constraint firstItem="jFI-G7-9uA" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.5" id="3LV-5J-GER"/>
46+
<constraint firstItem="D7O-6K-Gkp" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.5" id="8zT-h5-pzs"/>
47+
<constraint firstItem="5sG-Ud-Ubd" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.5" id="9c1-Xm-4hA"/>
48+
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="D7O-6K-Gkp" secondAttribute="bottom" id="Bza-LD-t2J"/>
49+
<constraint firstItem="vYq-Ws-PIM" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="IsQ-J2-C8d"/>
50+
<constraint firstItem="jFI-G7-9uA" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="R4K-cL-gAe"/>
51+
<constraint firstItem="gOY-DI-0UP" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="X6L-cJ-dne"/>
52+
<constraint firstItem="vYq-Ws-PIM" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.25" id="YCu-44-qcU"/>
53+
<constraint firstItem="gOY-DI-0UP" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.5" id="ZDC-XY-yFj"/>
54+
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="5sG-Ud-Ubd" secondAttribute="bottom" id="aBh-Ub-epn"/>
55+
<constraint firstItem="5sG-Ud-Ubd" firstAttribute="leading" secondItem="D7O-6K-Gkp" secondAttribute="trailing" id="atc-mP-ttY"/>
56+
<constraint firstItem="D7O-6K-Gkp" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.5" id="bgc-3S-zXE"/>
57+
<constraint firstAttribute="trailing" secondItem="gOY-DI-0UP" secondAttribute="trailing" id="hGm-hu-qoE"/>
58+
<constraint firstItem="D7O-6K-Gkp" firstAttribute="leading" secondItem="vYq-Ws-PIM" secondAttribute="trailing" id="hwZ-FV-33I"/>
59+
<constraint firstItem="vYq-Ws-PIM" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.5" id="l4G-vD-XwD"/>
60+
<constraint firstItem="jFI-G7-9uA" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="lu1-bs-CEY"/>
61+
<constraint firstItem="5sG-Ud-Ubd" firstAttribute="width" secondItem="8bC-Xf-vdC" secondAttribute="width" multiplier="0.25" id="n79-lG-kJb"/>
62+
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="vYq-Ws-PIM" secondAttribute="bottom" id="s5G-Mz-pJb"/>
63+
<constraint firstItem="jFI-G7-9uA" firstAttribute="height" secondItem="8bC-Xf-vdC" secondAttribute="height" multiplier="0.5" id="ukF-Bd-AQi"/>
64+
<constraint firstAttribute="trailing" secondItem="5sG-Ud-Ubd" secondAttribute="trailing" id="y7K-OE-scE"/>
65+
</constraints>
2066
</view>
67+
<connections>
68+
<outlet property="bottomCenter" destination="D7O-6K-Gkp" id="nHu-FB-rCw"/>
69+
<outlet property="bottomLeft" destination="vYq-Ws-PIM" id="dhJ-8d-HjK"/>
70+
<outlet property="bottomRight" destination="5sG-Ud-Ubd" id="Zhh-uE-3XD"/>
71+
<outlet property="topLeft" destination="jFI-G7-9uA" id="VDi-Je-Q0I"/>
72+
<outlet property="topRight" destination="gOY-DI-0UP" id="Xzp-pC-ff2"/>
73+
</connections>
2174
</viewController>
2275
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
2376
</objects>

AASquaresLoadingDemo/AASquaresLoadingDemo/ViewController.swift

+56-16
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,61 @@ import UIKit
1010
import AASquaresLoading
1111

1212
class ViewController: UIViewController {
13-
14-
override func viewDidLoad() {
15-
super.viewDidLoad()
16-
// Do any additional setup after loading the view, typically from a nib.
17-
18-
let square = AASquaresLoading(target: self.view)
19-
square.backgroundColor = UIColor.yellowColor().colorWithAlphaComponent(0.1)
20-
square.start()
21-
}
22-
23-
override func didReceiveMemoryWarning() {
24-
super.didReceiveMemoryWarning()
25-
// Dispose of any resources that can be recreated.
26-
}
27-
28-
13+
14+
@IBOutlet weak var topLeft: AASquaresLoading!
15+
@IBOutlet weak var topRight: UIView!
16+
@IBOutlet weak var bottomRight: UIView!
17+
@IBOutlet weak var bottomCenter: UIView!
18+
@IBOutlet weak var bottomLeft: UIView!
19+
20+
var topRightSquare : AASquaresLoading!
21+
var bottomRightSquare : AASquaresLoading!
22+
var bottomCenterSquare : AASquaresLoading!
23+
var bottomLeftSquare : AASquaresLoading!
24+
25+
override func viewDidLoad() {
26+
super.viewDidLoad()
27+
// Do any additional setup after loading the view, typically from a nib.
28+
29+
topRightSquare = AASquaresLoading(target: self.topRight, size: 40)
30+
topRightSquare.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.4)
31+
topRightSquare.color = UIColor.whiteColor()
32+
topRightSquare.start()
33+
34+
bottomRightSquare = AASquaresLoading(target: self.bottomRight)
35+
bottomRightSquare.backgroundColor = nil
36+
bottomRightSquare.color = UIColor.yellowColor()
37+
bottomRightSquare.start(4.0)
38+
39+
bottomCenterSquare = AASquaresLoading(target: self.bottomCenter)
40+
bottomCenterSquare.backgroundColor = UIColor.redColor()
41+
bottomCenterSquare.color = UIColor.whiteColor()
42+
bottomCenterSquare.start()
43+
bottomCenterSquare.stop(8.0)
44+
45+
bottomLeftSquare = AASquaresLoading(target: self.bottomLeft)
46+
bottomLeftSquare.color = UIColor.blackColor()
47+
bottomLeftSquare.backgroundColor = UIColor.clearColor()
48+
bottomLeftSquare.start()
49+
}
50+
51+
override func viewDidLayoutSubviews() {
52+
super.viewDidLayoutSubviews()
53+
54+
self.topRightSquare.setNeedsLayout()
55+
self.bottomRightSquare.setNeedsLayout()
56+
self.bottomCenterSquare.setNeedsLayout()
57+
self.bottomLeftSquare.setNeedsLayout()
58+
}
59+
60+
override func didReceiveMemoryWarning() {
61+
super.didReceiveMemoryWarning()
62+
// Dispose of any resources that can be recreated.
63+
}
64+
65+
override func prefersStatusBarHidden() -> Bool {
66+
return true
67+
}
68+
2969
}
3070

0 commit comments

Comments
 (0)