This is a funny switch for iOS - 一个有趣的switch
This is a funny switch for iOS
一个有趣的switch
Thank Dribbble for providing inspiration
1.pod "LLSwitch"
2.pod install // 若获取失败请重新 pod setup
3.#import "LLSwitch.h"
1.Add "LLSwitch" files to your Project // 直接导入“LLSwitch”文件夹到项目中
2.#import "LLSwitch.h"
LLSwitch *llSwitch = [[LLSwitch alloc] initWithFrame:CGRectMake(100, 100, 120, 60)];
[self.view addSubview:llSwitch];
[llSwitch setOn:YES]; // set on and off 设置开关
[llSwitch setOn:YES animated:YES];
* delegate 代理监听
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.