When I add an icon to a UIBarButtonItem
via the Interface Builder, the icon is displayed white. When I add the same icon file programmatically to another
Answer: If you want it white, color your image white.
Details:
UIBarButtonItems behave a little differently depending on how you use them.
When adding to a UIToolbar
:
initWithImage:style:target:action:
creates "white icons" (image color is ignored, opaque pixels are used as a mask to create a white image).
This is true for bordered
and plain
styles (but on UIToolbar only).
initWithCustomView:
displays normal colored image.
When adding to a UINavigationItem
:
initWithImage:style:target:action:
creates colored images and converts plain
to bordered
.