IPhone, casting a string as hex representation of an integer
11 Feb
Recently i have found a nice routine that convers hex color to UIColor objects to be used on UIComponents : http://cocoamatic.blogspot.com/2010/07/uicolor-macro-with-hex-values.html
but i was confronted to a little problem, the given colors are Strings and the routine only works with hex representation of integers. So this is a little trick to make the conversion :
unsigned int hexSeparatorColor; NSScanner *scanner = [NSScanner scannerWithString:@"0xFF0000"]; [scanner scanHexInt:&hexSeparatorColor]; [scanner release];
hexSeparatorColor will contain the hex representation of the casted string !
Comments
Powered by Facebook Comments















Application Developer and Technical Project Manager in a wide variety of business applications. Particularly interested in client/server and relational database design using MySQL. Always interested in migration projects, as well as close interaction with the DB manufacturers.
No comments yet