Not that I am going forward with this, but this seems to determine if the
color is b/w/gray or color:

-(void) buttonClicked:(id)sender {
    UIButton *resultButton = (UIButton *)sender;
    UIColor *color = [resultButton titleColorForState:UIControlStateNormal];
    CGColorRef color2 = [color CGColor];
    int numComponents = CGColorGetNumberOfComponents(color2);

    if( numComponents == 2 ){
        //gray (value of black and alpha)
    } else {
        //color
    }
}


On Thu, Aug 5, 2010 at 1:56 PM, Nick Zitzmann <n...@chronosnet.com> wrote:

>
> On Aug 5, 2010, at 11:45 AM, Eric E. Dolecki wrote:
>
> > How can I check what the color is in order to manipulate the button after
> > it's pressed? If it's gray, do one thing, if it's another color, do
> > something else. I'm not sure how to run an if on it yet.
>
> On iOS you'd have to use the functions CGColorGetColorSpace(),
> CGColorGetNumberOfComponents(), and CGColorGetComponents() to access the
> color space and the components, but I really can't recommend branching on
> color information, because color components are floating point numbers
> rather than integers.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>


-- 

Interactive Designer and Developer
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to