Skip to content

Custom segmented Control menu in Swift for UI flat iOS designs

License

Notifications You must be signed in to change notification settings

pranavansp/SPSegmentedControl

Repository files navigation

SPSegmentedControl

Custom segmented Control menu in Swift 3 for UI flat iOS designs

Screenshots

Features

  • Supports additional new segments
  • Customizable attributes for Border Width, Border Color, Text Color, Selected Color, Selected Text Color.

Installation

The easiest way of installing SPSegmentedControl is from cloning SPSegmentedControl repository to your PC add SPCustomSegment.swift into your Xcode project file.

Usage

@IBAction func customSegmentValChnge(_ sender: CustomSegment) {
        switch sender.selectedSegmentIndex {
        case 0:
            print("SMS")
            break
        case 1:
            print("Interuption")
            break
        case 2:
             print("Disconnection")
            break
        default:
        }
    }

The demo project

demo project will be upload soon.

How to use

To start using SPSegmentedControl you have to add the class wherever you want to use: "SPCustomSegment.swift"

Create new View and Select custom class in -> Identity inspector to select SPCustomSegment under Custom Class.

Properties

The parameters you are able to modify are the following:

Border Width : Width of the border line around segments and control.
Border Color : Border line color around segments and control.
Text Color : Text color attributes for non selected state.
Selected Text Color :Text color for segment in selected state.
Selected Color : Background color for segment in selected state.

License

SPSegmentedControl is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

If this code was helpful, I would love to hear from you.

Twitter : @Pranavan
If you have any questions please post your comments on @BeTheDev