From 182c98f690aa4bb0a830eedf0827455171f17185 Mon Sep 17 00:00:00 2001 From: Felipe Date: Fri, 6 Apr 2018 16:19:50 -0300 Subject: [PATCH 1/2] Cancel text editable --- ALLoadingView/Source/ALLoadingView.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ALLoadingView/Source/ALLoadingView.swift b/ALLoadingView/Source/ALLoadingView.swift index 40288d7..5269bc5 100644 --- a/ALLoadingView/Source/ALLoadingView.swift +++ b/ALLoadingView/Source/ALLoadingView.swift @@ -103,6 +103,8 @@ public class ALLoadingView: NSObject { public lazy var messageFont: UIFont = UIFont.systemFont(ofSize: 25.0) /// Text message. "Loading" by default. public lazy var messageText: String = "Loading" + /// Text cancel button. "Cancel" by default. + public lazy var cancelText: String = "Cancel" /// Read-only flag for checking is loading view is presented on screen. Also returns TRUE during disappearance/appearance animation. public var isPresented: Bool { return loadingViewPresented @@ -344,7 +346,7 @@ public class ALLoadingView: NSObject { for view in subviews { if view is UIButton { - (view as! UIButton).setTitle("Cancel", for: UIControlState()) + (view as! UIButton).setTitle(cancelText, for: UIControlState()) (view as! UIButton).addTarget(self, action: #selector(ALLoadingView.cancelButtonTapped(_:)), for: .touchUpInside) } } @@ -357,7 +359,7 @@ public class ALLoadingView: NSObject { for view in subviews { if view is UIButton { - (view as! UIButton).setTitle("Cancel", for: UIControlState()) + (view as! UIButton).setTitle(cancelText, for: UIControlState()) (view as! UIButton).addTarget(self, action: #selector(ALLoadingView.cancelButtonTapped(_:)), for: .touchUpInside) } } From dfc2ab525db25592b6783effa002a27d79a679d7 Mon Sep 17 00:00:00 2001 From: Mercury The Planet Date: Mon, 15 Jul 2019 16:15:43 -0300 Subject: [PATCH 2/2] Adjusting code modified to Swift 4.2. --- ALLoadingView/Source/ALLoadingView.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ALLoadingView/Source/ALLoadingView.swift b/ALLoadingView/Source/ALLoadingView.swift index 7bf7027..df24ec0 100644 --- a/ALLoadingView/Source/ALLoadingView.swift +++ b/ALLoadingView/Source/ALLoadingView.swift @@ -346,7 +346,7 @@ public class ALLoadingView: NSObject { for view in subviews { if view is UIButton { - (view as! UIButton).setTitle(cancelText, for: UIControlState()) + (view as! UIButton).setTitle(cancelText, for: UIControl.State()) (view as! UIButton).addTarget(self, action: #selector(ALLoadingView.cancelButtonTapped(_:)), for: .touchUpInside) } } @@ -359,7 +359,7 @@ public class ALLoadingView: NSObject { for view in subviews { if view is UIButton { - (view as! UIButton).setTitle(cancelText, for: UIControlState()) + (view as! UIButton).setTitle(cancelText, for: UIControl.State()) (view as! UIButton).addTarget(self, action: #selector(ALLoadingView.cancelButtonTapped(_:)), for: .touchUpInside) } }