Skip to content
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

Merged
merged 11 commits into from Jun 18, 2015
Merged

Feature/text on a knob #1

merged 11 commits into from Jun 18, 2015

Conversation

richardtop
Copy link

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?

@vadymmarkov
Copy link

@richardoti Not related to this, could you configure you git properly? I mean set

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com


/*
* Initialization
*/
public convenience init() {
self.init(frame: CGRectMake(0, 0, 50, 30))
self.init(frame: CGRectMake(0, 0, 50, 31))

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? 😃

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is a mistake in the library. Also, I have to change 50 to 51.
Apple has 51x31 as standard slider dimensions, I've checked in View Debugger.
screen shot 2015-06-18 at 12 36 49

I think it is good idea to extract these values to the separate constant, as they being used quite frequently.

@richardtop
Copy link
Author

@vadymmarkov, fixed the problems, now it should be OK.

@vadymmarkov
Copy link

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 ?

@richardtop
Copy link
Author

@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.

vadymmarkov added a commit that referenced this pull request Jun 18, 2015
@vadymmarkov vadymmarkov merged commit 4e5b019 into master Jun 18, 2015
@vadymmarkov vadymmarkov deleted the feature/text-on-a-knob branch June 18, 2015 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants