Giter Site home page Giter Site logo

vascome / uitextswitch Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 67 KB

UITextSwitch is a UIControl subclass which is similar to UISwitch, but with a text inside control on left or right side

Objective-C 100.00%
uicontrol uiswitch switch textswitcher textswitch

uitextswitch's Introduction

UITextSwitch

UITextSwitch is a UIControl subclass which is similar to UISwitch, but with a text inside control on left or right side

alt text

alt text

Installation

Drag the “UITextSwitch.h and .m” file into your Xcode project

Usage via Interface Builder

Drag a custom view into your storyboard and change it’s class to “UITextSwitch”. Use the attributes inspector to optionally set the switch’s basic properties:

offText/onText String

isOn boolean

offColor/onColor color

borderColor color

backgroundColor color

borderWidth float

UITwoStateSwitch

UITwoStateSwitch is a UIControl subclass which is similar to UISwitch. It has two switches inside and trigger the change by pressing one of the state. Highly configuarble and easy to change to fit any needs. BTW UISwitch can state by any click at them.

alt text

Installation

Drag the “UITwoStateSwitch.h and .m” file into your Xcode project

Usage via Interface Builder

Drag a custom view into your storyboard and change it’s class to “UITwoStateSwitch”. Use the attributes inspector to optionally set the switch’s basic properties:

left active state:

leftText - text inside state ,NSString leftIcon - image inside state, UIImage leftColor - state backgorund color, UIColor leftTextColor - text color inside state, UIColor

if leftIcon is set, left text is ignored.

right active state:

rightText - text inside state ,NSString rightIcon - image inside state, UIImage rightColor - state backgorund color, UIColor rightTextColor - text color inside state, UIColor

if rightIcon is set, right text is ignored.

inactive state (both right and left)

offColor - state backgorund color,UIColor offColor - text color inside state, UIColor offItemBorderColor - border color for inactive state.

generic control properties

borderColor - UIColor backgroundColor - UIColor borderWidth - float

Only one state is active, left or right.

  • (void)setActive:(BOOL)active animated:(BOOL)animated; if active = true - left is active, otherwise right is active.

there are two blocks leftItemClickedBlock and rightItemClickedBlock

uitextswitch's People

Contributors

vasily-popov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

uitextswitch's Issues

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.