Skip to content

Commit 735927d

Browse files
committed
Default color for loading view, error view and no dtaa view added
1 parent 964c4ef commit 735927d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

LoadingViewController/Classes/LoadingViewController.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class LoadingViewController: UIViewController {
4545
@IBOutlet public var contentView: UIView!
4646

4747
public var lastError: NSError?
48+
var defaultLoadingColor = UIColor(colorLiteralRed: 250/255, green: 250/255, blue: 250/255, alpha: 1)
49+
public var loadingViewColor: UIColor?
50+
public var noDataViewColor: UIColor?
51+
public var errorViewColor: UIColor?
4852

4953
var visibleContentType: ContentType = .Undefined
5054
var activeView: UIView?
@@ -72,12 +76,14 @@ public class LoadingViewController: UIViewController {
7276

7377
func defaultNoDataView() -> UIView {
7478
let view = NoDataView.viewWithStyle(noDataViewStyle())
79+
view.backgroundColor = noDataViewColor ?? loadingViewColor
7580
view.message = noDataMessage
7681
return view
7782
}
7883

7984
func defaultErrorView(action: ActionHandler? = nil) -> UIView {
8085
let view = ErrorView.viewWithStyle(errorViewStyle(), actionHandler: action)
86+
view.backgroundColor = errorViewColor ?? loadingViewColor
8187
view.title = errorTitle
8288
view.message = errorMessage
8389
view.image = errorIcon
@@ -86,6 +92,7 @@ public class LoadingViewController: UIViewController {
8692

8793
func defaultLoadingView() -> UIView {
8894
let view = LoadingView.viewWithStyle(loadingViewStyle())
95+
view.backgroundColor = loadingViewColor ?? defaultLoadingColor
8996

9097
//TODO: add title, background image, etc.
9198
view.title = "Loading"

0 commit comments

Comments
 (0)