Does anyone know how to add colors like 0xFF0000 to an NSArray? I know how to use an array, I just don't know how to store that value.
Adding colors to an NSArray
(5 posts) (3 voices)-
Posted 10 months ago #
-
You have to wrap the value in NSNumber objects. Wrap the color (unsigned integer) in such an object and add it to the array. Later, use the "unsignedIntValue" method to get the color in the original format.
That's one of the things that are really awkward to do in Objective-C ...
Posted 10 months ago # -
Or you could use an uint c-array and avoid NSArray all together. :p
Posted 10 months ago # -
LOL, noooo, that would be too easy! Where's the fun in that?!
Posted 10 months ago # -
LOL. I think I will use an NSArray for its NSUserDefaults-archivable-ness. :p
Thanks to both of you though!Posted 10 months ago #
Reply
You must log in to post.