Skip to content

Commit 2411e91

Browse files
committed
Merge pull request #6 from MarvinNazari/master
Hide when stopped option
2 parents b03a66b + f8fbac5 commit 2411e91

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

NVActivityIndicatorView/NVActivityIndicatorView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public class NVActivityIndicatorView: UIView {
5050
private var size: CGSize
5151

5252
var animating: Bool = false
53+
var hidesWhenStopped: Bool = true
5354

5455
/**
5556
Create a activity indicator view with default type, color and size
@@ -128,6 +129,9 @@ public class NVActivityIndicatorView: UIView {
128129
Start animation
129130
*/
130131
public func startAnimation() {
132+
if hidesWhenStopped && hidden {
133+
hidden = false
134+
}
131135
if (self.layer.sublayers == nil) {
132136
setUpAnimation()
133137
}
@@ -141,6 +145,9 @@ public class NVActivityIndicatorView: UIView {
141145
public func stopAnimation() {
142146
self.layer.speed = 0
143147
self.animating = false
148+
if hidesWhenStopped && !hidden {
149+
hidden = true
150+
}
144151
}
145152

146153
// MARK: Privates

0 commit comments

Comments
 (0)