Willkommen auf unserem Seminar-Blog

Immer auf dem aktuellen Stand bleiben

Dieser Seminar-Blog befindet sich noch im Aufbau und wird in den kommenden Tagen entsprechend verfeinert.

Member Login

Lost your password?

Registration is closed

Sorry, you are not allowed to register by yourself on this site!

You must either be invited by one of our team member or request an invitation by email at viad.info {at} zhdk {dot} ch.

COLOR: Use HEX instead of RGB

13. Oktober 2010

STEP 1: Copy the following blue text into your .h file:
#import <UIKit/UIKit.h> // COLOR: Use HEX instead of RGB 
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]
--------- STEP 2: In the .m file this is accessible just like in the following to sample lines:
label.textColor = UIColorFromRGBWithAlpha(0xffff00,1.0);
label.backgroundColor = UIColorFromRGBWithAlpha(0x333333, 0.8);