- Notifications
You must be signed in to change notification settings - Fork60
This is a funny switch for iOS - 一个有趣的switch
License
NotificationsYou must be signed in to change notification settings
lilei644/LLSwitch
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a funny switch for iOS
一个有趣的switch
ThankDribbble for providing inspiration
- pod
1.pod "LLSwitch"2.pod install // 若获取失败请重新 pod setup3.#import "LLSwitch.h"
- Common
1.Add "LLSwitch" files to your Project // 直接导入“LLSwitch”文件夹到项目中2.#import "LLSwitch.h"
- 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);}
IOS 6.0 Above
LLSwitch is provided under the MIT license. See LICENSE file for details.
About
This is a funny switch for iOS - 一个有趣的switch
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published