Giter Site home page Giter Site logo

llswitch's Introduction

LLSwitch

This is a funny switch for iOS
一个有趣的switch

Thank Dribbble for providing inspiration


Preview 预览

LLSwitchDemo

Installation  安装

  • pod
1.pod "LLSwitch"
2.pod install       // 若获取失败请重新 pod setup
3.#import "LLSwitch.h"
  • Common
1.Add "LLSwitch" files to your Project   // 直接导入“LLSwitch”文件夹到项目中
2.#import "LLSwitch.h"

Usage  用法

  • Init  初始化
LLSwitch *llSwitch = [[LLSwitch alloc] initWithFrame:CGRectMake(100, 100, 120, 60)];
[self.view addSubview:llSwitch];
  • Reset Base Property  重设基本属性
llSwitch.onColor = [UIColor blueColor];    // switch is open color    开关打开的颜色
llSwitch.offColor = [UIColor grayColor];    // switch is close color    开关关闭的颜色
llSwitch.faceColor = [UIColor whiteColor];    // switch face color    圆脸的颜色
llSwitch.animationDuration = 1.2f;    // switch open or close animation time    开关的动画时间

[llSwitch setOn:YES];                 // set on and off     设置开关
[llSwitch setOn:YES animated:YES];
  • delegate  代理监听
<LLSwitchDelegate>
llSwitch.delegate = self;

-(void)didTapLLSwitch:(LLSwitch *)llSwitch {
NSLog(@"start");
}

- (void)animationDidStopForLLSwitch:(LLSwitch *)llSwitch {
NSLog(@"stop");
}

- (void)valueDidChanged:(LLSwitch *)llSwitch on:(BOOL)on {
NSLog(@"stop --- on:%hhd", on);
}
  • support xib and storyboard 支持xib和storyboard LLSwitchForXib

Requirements  版本要求

IOS 6.0 Above

License

LLSwitch is provided under the MIT license. See LICENSE file for details.

llswitch's People

Contributors

lilei644 avatar

Watchers

James Cloos 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.