From 51484a03a263cc6cd5f851e3a4ebf4d6f0405b8d Mon Sep 17 00:00:00 2001 From: rafleze Date: Tue, 14 Feb 2017 18:23:01 +0100 Subject: [PATCH] Buttons background parameters added --- ScrollPager/Source/ScrollPager.swift | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ScrollPager/Source/ScrollPager.swift b/ScrollPager/Source/ScrollPager.swift index e011080..9f2c541 100644 --- a/ScrollPager/Source/ScrollPager.swift +++ b/ScrollPager/Source/ScrollPager.swift @@ -56,7 +56,15 @@ import UIKit @IBInspectable public var selectedTextColor: UIColor = UIColor.darkGray { didSet { redrawComponents() } } - + + @IBInspectable public var bgColor: UIColor = UIColor.lightGray { + didSet { redrawComponents() } + } + + @IBInspectable public var selectedBGColor: UIColor = UIColor.darkGray { + didSet { redrawComponents() } + } + @IBInspectable public var font: UIFont = UIFont.systemFont(ofSize: 13) { didSet { redrawComponents() } } @@ -255,7 +263,8 @@ import UIKit let button = buttons[i] button.frame = CGRect(x: width * CGFloat(i), y: 0, width: width, height: height) button.setTitleColor((i == selectedIndex) ? selectedTextColor : textColor, for: .normal) - button.titleLabel?.font = (i == selectedIndex) ? selectedFont : font + button.backgroundColor = (i == selectedIndex) ? selectedBGColor :bgColor + button.titleLabel?.font = (i == selectedIndex) ? selectedFont : font } }