Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Added UISlider category #38

Merged
merged 2 commits into from
Feb 21, 2014
Merged

Added UISlider category #38

merged 2 commits into from
Feb 21, 2014

Conversation

ccbb
Copy link
Contributor

@ccbb ccbb commented Feb 20, 2014

Hi,

The styling of UISliders is not triggered since its didMoveToWindow does nothing. I added category method that calls super to solve this.

Cheers,

Cail

…dded category method that calls super to trigger styling.
@cloudkite
Copy link
Contributor

I think would be better to use swizzling for this. As calling super in this context will call the superclass (UIControl) implementation of didMoveToWindow.

Swizzling is safer in case there are other categories overriding didMoveToWindow or if the original UISlider didMoveToWindow has code which needs to be called. We are assuming its empty as it not calling [super didMoveToWindow] but there is no way of knowing for sure.

+ (void)load {
    [self cas_swizzleInstanceSelector:@selector(didMoveToWindow)
                      withNewSelector:@selector(cas_didMoveToWindow)];
}

- (void)cas_didMoveToWindow {
    [self cas_updateStyling];
    [self cas_didMoveToWindow];
}

@ccbb
Copy link
Contributor Author

ccbb commented Feb 21, 2014

Thanks, that is a good point. I have replaced the call to [super didMoveToWindow] with your suggestion.

@cloudkite
Copy link
Contributor

Thanks again!

cloudkite added a commit that referenced this pull request Feb 21, 2014
Added UISlider category
@cloudkite cloudkite merged commit 5499751 into ClassyKit:master Feb 21, 2014
@cloudkite cloudkite mentioned this pull request May 25, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants