0

EDIT: This answer solved my problem - https://stackoverflow.com/a/9203647/1176870

I have some buttons that I'm using as toggles. They start off with the colors rgb(3,61,115) for off and rgb(0,128,255) for on. The colors are initially assigned from the background color selector on the storyboard. This is how they look

enter image description here

After a user clicks on a button the colors change programmatically with the following UIColors

UIColor *on = [UIColor colorWithRed:0 green:128.0/255.0 blue:1 alpha:1];
UIColor *off = [UIColor colorWithRed:3.0/255.0 green:61.0/255.0 blue:115.0/255.0 alpha:1];

However, once they change programmatically, the colors are not the same. You can see the change in the image below.

enter image description here

Why is this happening and how can I fix it?

Community
  • 1
  • 1
Chris Stillwell
  • 10,266
  • 10
  • 67
  • 77
  • What is the alpha and opacity values of the initial one? Looks to me a lot like it could be that. Also i doubt it would have anyhing to do with it, but with floating point is it possible 255.0/255.0 != 1 in this case? – onaclov2000 Jan 09 '15 at 22:40
  • 1
    Probably related: [Wrong color in Interface Builder](http://stackoverflow.com/questions/14578759/wrong-color-in-interface-builder) and [Weird colors in XCode Interface Builder?](http://stackoverflow.com/questions/7488378/weird-colors-in-xcode-interface-builder) – Matthias Bauch Jan 09 '15 at 22:42
  • @onaclov2000 the alpha for the originals is 1 with a 'Clear Color' tint – Chris Stillwell Jan 09 '15 at 22:45
  • @MatthiasBauch yep, the http://stackoverflow.com/questions/7488378/weird-colors-in-xcode-interface-builder question answered mine... *sigh* xcode, why you do these things? – Chris Stillwell Jan 09 '15 at 22:51

0 Answers0