Skip to content

Commit

Permalink
Added setting options to change width and height of activity
Browse files Browse the repository at this point in the history
  • Loading branch information
Esqarrouth committed Jan 24, 2016
1 parent e4574b5 commit 53c89e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions EZLoadingActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public struct EZLoadingActivity {
public static var FailText = "Failure"
public static var SuccessColor = UIColor(red: 68/255, green: 118/255, blue: 4/255, alpha: 1.0)
public static var FailColor = UIColor(red: 255/255, green: 75/255, blue: 56/255, alpha: 1.0)
public static var ActivityWidth = UIScreen.ScreenWidth / Settings.WidthDivision
public static var ActivityHeight = ActivityWidth / 3
public static var WidthDivision: CGFloat {
get {
if UIDevice.currentDevice().userInterfaceIdiom == UIUserInterfaceIdiom.Pad {
Expand Down Expand Up @@ -102,9 +104,7 @@ public struct EZLoadingActivity {
var UIDisabled = false

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

textLabel = UILabel(frame: CGRect(x: 60, y: yPosition, width: width - 70, height: 40))
textLabel = UILabel(frame: CGRect(x: 60, y: yPosition, width: Settings.ActivityWidth - 70, height: 40))
textLabel.textColor = Settings.TextColor
textLabel.font = UIFont(name: Settings.FontName, size: 30)
textLabel.adjustsFontSizeToFitWidth = true
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ EZLoadingActivity.show("Loading...", disableUI: false)
|FailText|
|SuccessColor|
|FailColor|
|ActivityWidth|
|ActivityHeight|

## Example Use Case:

Expand Down

0 comments on commit 53c89e8

Please sign in to comment.