Latest 0.0.3
Homepage https://github.com/MQZHot/ZSegmentedControl
License MIT
Platforms ios 8.0, requires ARC
Authors

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.

Latest podspec

{
    "name": "ZSegmentedControl",
    "version": "0.0.3",
    "summary": "Customizable segmented control, a UISwitch-like segmented control and Segmented pager written in Swift",
    "homepage": "https://github.com/MQZHot/ZSegmentedControl",
    "authors": {
        "mqz": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/MQZHot/ZSegmentedControl.git",
        "tag": "0.0.3"
    },
    "source_files": "ZSegmentedControl/ZSegmentedControl/*.{swift}",
    "requires_arc": true,
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    }
}

Pin It on Pinterest

Share This