ZSegmentedControl Save

Customizable segmented control, a UISwitch-like segmented control and Segmented pager written in Swift

Project README

ZSegmentedControl

Customizable segmented control, a UISwitch-like segmented control and Segmented pager written in Swift

image

How To Use

/// default `false`. if `true`, bounces past edge of content and back again
var bounces: Bool = false
/// selected index, default `0`
var selectedIndex: Int = 0
/// selectedScale, default `1.0`
var selectedScale: CGFloat = 1.0
/// textColor
var textColor: UIColor = UIColor.gray
/// selected textColor
var textSelectedColor: UIColor = UIColor.blue
/// textFont
var textFont: UIFont = UIFont.systemFont(ofSize: 15)

set image / text

/// only text
///
/// - Parameters:
///   - titles: text group
///   - style: The width style of the text is an enumeration, fixed width or adaptive
func setTitles(_ titles: [String], style: WidthStyle)

/// only image
///
/// - Parameters:
///   - images: image group
///   - selectedImages: selected image group, Ideally the same number of images, if not, the selected will be the item in images
///   - fixedWidth: The width is fixed
func setImages(_ images: [UIImage], selectedImages: [UIImage?]? = nil, fixedWidth: CGFloat)

/// both text image
///
/// - Parameters:
///   - titles: title group
///   - images: image group
///   - selectedImages: selected image group
///   - style: image potision
///   - fixedWidth: The width is fixed
func setHybridResource(_ titles: [String?], images: [UIImage?], selectedImages: [UIImage?]? = nil, style: HybridStyle = .normalWithSpace(0), fixedWidth: CGFloat)

setup cover

/// setup cover
///
/// - Parameters:
///   - color: color backgroundColor
///   - upDowmSpace: the distance of cover's up/down from item's up/down
///   - cornerRadius: radius
func setCover(color: UIColor, upDowmSpace: CGFloat = 0, cornerRadius: CGFloat = 0)

setup slider view

/// set slider
///
/// - Parameters:
///   - backgroundColor: slider backgroundColor
///   - position: Deciding on the slider position up or down, an enumeration
///   - widthStyle: The width of the slider is an enumeration, fixed width or adaptive
func setSilder(backgroundColor: UIColor,position: SliderPositionStyle, widthStyle: WidthStyle)

if you use segmented pager-like, use this method in scrollViewDelegate

/// use in contentScrollView `scrollViewDidScroll`
func contentScrollViewDidScroll(_ scrollView: UIScrollView)
/// use in contentScroll `scrollViewWillBeginDragging`
func contentScrollViewWillBeginDragging()

Contact

LICENSE

ZSegmentedControl is released under the MIT license. See LICENSE for details.

Open Source Agenda is not affiliated with "ZSegmentedControl" Project. README Source: MQZHot/ZSegmentedControl
Stars
31
Open Issues
1
Last Commit
6 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating