Giter Site home page Giter Site logo

mohsinalimat / zsegmentedcontrol Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mqzhot/zsegmentedcontrol

1.0 2.0 0.0 303 KB

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

License: MIT License

Ruby 2.42% Swift 97.58%

zsegmentedcontrol's Introduction

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.

zsegmentedcontrol's People

Contributors

mqzhot avatar

Stargazers

MohsinAli avatar

Watchers

MohsinAli avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.