• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Cahnging bgColor of a UIView not working.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cahnging bgColor of a UIView not working.


  • Subject: Re: Cahnging bgColor of a UIView not working.
  • From: Gustavo Pizano <email@hidden>
  • Date: Thu, 30 Jul 2009 09:16:47 +0200

Well in fact that was my mistake, I took the color picker, and didn't set the values as percentage, but as 8 bit rgb.

G.
On Jul 30, 2009, at 6:36 AM, Alan Rogers wrote:

Check out

http://www.panic.com/~wade/picker/

For a 'Developer Friendly' colour picker :P

Al


On 30/07/2009, at 2:34 PM, Henry McGilton (Boulevardier) wrote:


On Jul 29, 2009, at 11:27 AM, Eric E. Dolecki wrote:

This is good to use:
#define UIColorFromRGB(rgbValue) [UIColor \ colorWithRed:((float) ((rgbValue
& 0xFF0000) >> 16))/255.0 \ green:((float)((rgbValue & 0xFF00) >> 8))/255.0
\ blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]


cell.textColor = UIColorFromRGB(0x333333);

On Wed, Jul 29, 2009 at 1:04 PM, Brian Slick <email@hidden> wrote:

On Jul 29, 2009, at 12:56 PM, David Duncan wrote:

On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:

The arguments to that UIColor method should be in the range of 0 to 1.
Divide each RGB value by 255 to get them into that range.


This is more of a PSA than anything (because I've seen more than a fair
share of devs slap themselves on the head here too): Always ensure your
using floating point division if your going to do this. That means always
dividing by 255.0. I've seen too many people asking "why do I always get
black" and pointed out "because you forgot the .0" :).
--
David Duncan
Apple DTS Animation and Printing


*jaw dropping*

Well, I guess that explains that. I finally just gave up and did the math
myself.


Good tip, thanks!
Brian

What I've always wondered in this particular context of our color component specifications
ranging from 0.0 to 1.0 is why the System RGB color chooser displays the component
values in the range 0 to 255? You'd think by now there'd be a 'Developer Friendly'
version of the chooser . . .


  Cheers,
      . . . . . . . .    Henry


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Cahnging bgColor of a UIView not working. (From: Gustavo Pizano <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: Gustavo Pizano <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: Brandon Walkin <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: David Duncan <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: Brian Slick <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: "Eric E. Dolecki" <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: "Henry McGilton (Boulevardier)" <email@hidden>)
 >Re: Cahnging bgColor of a UIView not working. (From: Alan Rogers <email@hidden>)

  • Prev by Date: Re: Listening to Eject command
  • Next by Date: Re: NSString and regular expressions
  • Previous by thread: Re: Cahnging bgColor of a UIView not working.
  • Next by thread: Re: Cahnging bgColor of a UIView not working.
  • Index(es):
    • Date
    • Thread