Skip to content

Commit f96b905

Browse files
add the ability to set a top margin for the spinner view, so the user can set the vertical position of the spinner.
1 parent 643411c commit f96b905

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/SwiftLoader/SwiftLoader.swift

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,19 @@ public class SwiftLoader: UIView {
4343
return Singleton.instance
4444
}
4545

46-
public class func show(animated animated: Bool) {
47-
self.show(title: nil, animated: animated)
46+
public class func show(animated: Bool) {
47+
self.show(nil, animated: animated, topMargin: 0)
4848
}
4949

50-
public class func show(title title: String?, animated : Bool) {
51-
50+
public class func show(animated: Bool, topMargin: Int) {
51+
self.show(nil, animated: animated, topMargin: topMargin)
52+
}
53+
54+
public class func show(title: String?, animated: Bool) {
55+
self.show(title, animated: animated, topMargin: 0)
56+
}
57+
58+
public class func show(title: String?, animated: Bool, topMargin: Int) {
5259
let currentWindow : UIWindow = UIApplication.sharedApplication().keyWindow!
5360

5461
let loader = SwiftLoader.sharedInstance
@@ -59,8 +66,7 @@ public class SwiftLoader: UIView {
5966

6067
let height : CGFloat = UIScreen.mainScreen().bounds.size.height
6168
let width : CGFloat = UIScreen.mainScreen().bounds.size.width
62-
let center : CGPoint = CGPointMake(width / 2.0, height / 2.0)
63-
69+
let center : CGPoint = CGPointMake(width / 2.0, height / 2.0 - CGFloat(topMargin))
6470
loader.center = center
6571

6672
if (loader.superview == nil) {

0 commit comments

Comments
 (0)