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

UIColor-Expanded Category Method in primary class #8

Open
PlutoniumDev opened this issue Apr 3, 2012 · 6 comments · Fixed by maddox/MAConfirmButton#2 · May be fixed by #14
Open

UIColor-Expanded Category Method in primary class #8

PlutoniumDev opened this issue Apr 3, 2012 · 6 comments · Fixed by maddox/MAConfirmButton#2 · May be fixed by #14

Comments

@PlutoniumDev
Copy link

In the UIColor-Expanded category class that comes with the project I noticed a warning that says: Category is implementing a method which will also be implemented by its primary class.

Can you make this a subclass instead or how should I resolve this and make the warning disappear?

Regards/
Jacob Lindgren

@PlutoniumDev
Copy link
Author

Has this problem been resolved yet? Still can't figure it out!

@zubko
Copy link

zubko commented May 27, 2012

I'm also using MAConfirmButton. I think that's happening because UIColor has a method now, which wasn't present when the UIColor-Expanded category was created.
You can check where this method is used in MAConfirmButton code. If it's not used anywhere (my bet) you can freely remove it. If it is used somewhere, remove it with caution after a check that the method in UIColor does the same job.

@PlutoniumDev
Copy link
Author

But when I comment out the method, in the UIColor-Extended class, the buttons tint color turns red from yellow. Here is the method that's causing all the trouble:

+ (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha {
    // Convert hsb to rgb
    CGFloat r,g,b;
    [self hue:hue saturation:saturation brightness:brightness toRed:&r green:&g blue:&b];

    // Create a color with rgb
    return [self colorWithRed:r green:g blue:b alpha:alpha];
}

When I'm creating the MAConfirmButton I use the colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;

In the method causing the trouble you convert it to be the above method. Any thoughts on this?

@zubko
Copy link

zubko commented Jun 2, 2012

If you are on a tight schedule I suggest you just to rename that conflicting method, and also rename all occurrences of it in MAConfirmButton code.

I don't use -setTint: in MAConfirmButton that's why I haven't that issue you are experiencing.

Looking deeper you may notice that this UIColor-Extended category provides it own getters for hue, saturation and brightness which MAConfirmButton also uses. So I think the problem is that MAConfirmButton must use HSB getters from UIColor also if this is possible, or UIColor-Extended method names must be changed to not conflict with iOS API.

@maddox
Copy link

maddox commented Sep 11, 2012

This is in fact a huge bug on iOS 6. Confirmed.

PR forthcoming.

@maddox
Copy link

maddox commented Sep 11, 2012

This is actually worse than I thought. This method has existed since iOS 2.0.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIColor_Class/Reference/Reference.html

Yuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants