New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/text on a knob #1
Conversation
Real UISwitch height is 31, not 30
@richardoti Not related to this, could you configure you git properly? I mean set
|
|
||
/* | ||
* Initialization | ||
*/ | ||
public convenience init() { | ||
self.init(frame: CGRectMake(0, 0, 50, 30)) | ||
self.init(frame: CGRectMake(0, 0, 50, 31)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to do it? 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vadymmarkov, fixed the problems, now it should be OK. |
Except one comment, everything looks ok for me. Since it's a fork I'm not sure if we should update it to our style guidelines, like change indents. What do you think @zenangst ? |
@vadymmarkov, cannot put the switchFrame into a class, as it is being used during initialization. I think, that by putting it outside the class, compiler preprocess it and allows me to use as init-frame, but if I put it into the class declaration, I get an error - as I am accessing instance property before initialization. About the guidelines: I think, for now it is better to keep it as it is, unless the control would be fully ready. As I am going to send pull request to the author, I don't think it is a good idea to update the style. |
So, I forked the library and added custom text on the knob functionality to it.
How to use:
Create the switch
set the text by: mySwitch.knobText = "HyperText"
The knob will adjust its width automatically.
Note: switch width has to be bigger than the width of the knob. (pay attention to the size of the text you set to it)
@vadymmarkov, @zenangst any thoughts on this?