lilei644 / llswitch Goto Github PK
View Code? Open in Web Editor NEWThis is a funny switch for iOS - 一个有趣的switch
License: MIT License
This is a funny switch for iOS - 一个有趣的switch
License: MIT License
好像有内存溢出。。。 用MLeakFinder 测试的时候,只是单纯addsubsview 到vc view里面 返回上一层就报了 循环引用了
只有手动点击switch才会有动画. 如果直接用 -setOn:
方法来设置开关的开与关(非初始化的时候设置), 就会出现bug, 脸会越滚越远😂
My account was compromised, as a result many spam issues got created across multiple repos. I am deleting all such issues. Please check my tweet: https://x.com/arghyac35/status/1729721954909684064?s=20
在每个tableviewcell中添加LLSwitch,默认都是on状态,然后数据源来记录每个cell的状态,手动改变一个LLSwitch状态,滚动几次就出问题了,不是关闭的时候出现笑脸,就是关闭的时候背景是on的背景。
麻烦楼主fix下,fix掉后我再接入使用。。。
你好,自动布局不会显示
//滑动开关
self.switchClose = [[LLSwitch alloc] init];
self.switchClose.onColor = [UIColor colorWithHex:BG_SHOUYE alpha:0.86]; // switch is open color 开关打开的颜色
self.switchClose.offColor = [UIColor colorWithHex:BG_SHOUYE alpha:0.66]; // switch is close color 开关关闭的颜色
self.switchClose.faceColor = HEXCOLOR(COLOR_TONGYI_LV); // switch face color 圆脸的颜色
self.switchClose.animationDuration = 1.2f; // switch open or close animation time 开关的动画时间
[self.view addSubview:self.switchClose];
[self.switchClose makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.view).offset(INSET);
// make.top.equalTo(self.).offset(INSET);
make.bottom.equalTo(self.bottomView.top).offset(-INSET);
make.width.equalTo(WIDTH_1*2);
make.height.equalTo(HEIGHT_6);
}];
At the moment, I can only use the didTapOnLLSwitch
method to detect a change in state. However, this is bad because:
If I have a LLSwitch that is originally on. And the user taps on it. The delegate method is called before the state changes. So if I get the on
property of the switch in the delegate method, I will get on, not off. This means that I need to reverse the Bool value to get the new on/off state.
That's just weird. If I come back after a few months I won't know what the !
is doing there. This confuses people.
You see, the original UISwitch
has a ValueChanged
control event. Why not add such a delegate method to LLSwitch
? It will look something like this:
func llSwitch(llSwitch: LLSwitch, didChangeValue value: Bool)
脸部模糊51*30
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.