Skip to content

Commit 53c89e8

Browse files
committed
Added setting options to change width and height of activity
1 parent e4574b5 commit 53c89e8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

EZLoadingActivity.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public struct EZLoadingActivity {
2525
public static var FailText = "Failure"
2626
public static var SuccessColor = UIColor(red: 68/255, green: 118/255, blue: 4/255, alpha: 1.0)
2727
public static var FailColor = UIColor(red: 255/255, green: 75/255, blue: 56/255, alpha: 1.0)
28+
public static var ActivityWidth = UIScreen.ScreenWidth / Settings.WidthDivision
29+
public static var ActivityHeight = ActivityWidth / 3
2830
public static var WidthDivision: CGFloat {
2931
get {
3032
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
@@ -102,9 +104,7 @@ public struct EZLoadingActivity {
102104
var UIDisabled = false
103105

104106
convenience init(text: String, disableUI: Bool) {
105-
let width = UIScreen.ScreenWidth / Settings.WidthDivision
106-
let height = width / 3
107-
self.init(frame: CGRect(x: 0, y: 0, width: width, height: height))
107+
self.init(frame: CGRect(x: 0, y: 0, width: Settings.ActivityWidth, height: Settings.ActivityHeight))
108108
center = CGPoint(x: UIScreen.mainScreen().bounds.midX, y: UIScreen.mainScreen().bounds.midY)
109109
autoresizingMask = [.FlexibleTopMargin, .FlexibleLeftMargin, .FlexibleBottomMargin, .FlexibleRightMargin]
110110
backgroundColor = Settings.BackgroundColor
@@ -119,7 +119,7 @@ public struct EZLoadingActivity {
119119
activityView.color = Settings.ActivityColor
120120
activityView.startAnimating()
121121

122-
textLabel = UILabel(frame: CGRect(x: 60, y: yPosition, width: width - 70, height: 40))
122+
textLabel = UILabel(frame: CGRect(x: 60, y: yPosition, width: Settings.ActivityWidth - 70, height: 40))
123123
textLabel.textColor = Settings.TextColor
124124
textLabel.font = UIFont(name: Settings.FontName, size: 30)
125125
textLabel.adjustsFontSizeToFitWidth = true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ EZLoadingActivity.show("Loading...", disableUI: false)
5353
|FailText|
5454
|SuccessColor|
5555
|FailColor|
56+
|ActivityWidth|
57+
|ActivityHeight|
5658

5759
## Example Use Case:
5860

0 commit comments

Comments
 (0)