z*y 发帖数: 1311 | 1 想在Storyboard里修改TabBarItem的image
总是不行,画面是灰色一片(红圈部分)
image本身不大(24X24)
谢谢指点 | f*******n 发帖数: 12623 | 2 https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/
UITabBarItem_Class/Reference/Reference.html#//apple_ref/occ/instm/
UITabBarItem/initWithTitle:image:tag:
"The alpha values in the source image are used to create the unselected and
selected images—opaque values are ignored." | z*y 发帖数: 1311 | 3
and
Thanks. But my images do not contain alpha value.
【在 f*******n 的大作中提到】 : https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/ : UITabBarItem_Class/Reference/Reference.html#//apple_ref/occ/instm/ : UITabBarItem/initWithTitle:image:tag: : "The alpha values in the source image are used to create the unselected and : selected images—opaque values are ignored."
| f*******n 发帖数: 12623 | 4 Every pixel in a PNG image has an RGBA (red, green, blue, alpha) value.
Alpha controls the transparency of that pixel. In a "normal" (opaque) image,
every pixel has alpha = 1 (not transparent at all).
Tab bar icons do not care about the RGB parts; only the Alpha. Alpha = 0
means transparent; alpha = 1 means white (when unselected) or blue (when
selected). You can only control the range in between (it's basically like a
"grayscale" image, except in alpha channel instead of RGB). You don't have
control over the colors other than black, white, or gray.
So basically, what you have to do is first make a grayscale (black and white
) image, and then set those black/white values in the alpha channel instead
of in the RGB (RGB will be ignored).
【在 z*y 的大作中提到】 : : and : Thanks. But my images do not contain alpha value.
| z*y 发帖数: 1311 | 5 got it, thank you.
try some website that converts to alpha, works!
image,
a
white
instead
【在 f*******n 的大作中提到】 : Every pixel in a PNG image has an RGBA (red, green, blue, alpha) value. : Alpha controls the transparency of that pixel. In a "normal" (opaque) image, : every pixel has alpha = 1 (not transparent at all). : Tab bar icons do not care about the RGB parts; only the Alpha. Alpha = 0 : means transparent; alpha = 1 means white (when unselected) or blue (when : selected). You can only control the range in between (it's basically like a : "grayscale" image, except in alpha channel instead of RGB). You don't have : control over the colors other than black, white, or gray. : So basically, what you have to do is first make a grayscale (black and white : ) image, and then set those black/white values in the alpha channel instead
| z*y 发帖数: 1311 | 6 想在Storyboard里修改TabBarItem的image
总是不行,画面是灰色一片(红圈部分)
image本身不大(24X24)
谢谢指点 | f*******n 发帖数: 12623 | 7 https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/
UITabBarItem_Class/Reference/Reference.html#//apple_ref/occ/instm/
UITabBarItem/initWithTitle:image:tag:
"The alpha values in the source image are used to create the unselected and
selected images—opaque values are ignored." | z*y 发帖数: 1311 | 8
and
Thanks. But my images do not contain alpha value.
【在 f*******n 的大作中提到】 : https://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/ : UITabBarItem_Class/Reference/Reference.html#//apple_ref/occ/instm/ : UITabBarItem/initWithTitle:image:tag: : "The alpha values in the source image are used to create the unselected and : selected images—opaque values are ignored."
| f*******n 发帖数: 12623 | 9 Every pixel in a PNG image has an RGBA (red, green, blue, alpha) value.
Alpha controls the transparency of that pixel. In a "normal" (opaque) image,
every pixel has alpha = 1 (not transparent at all).
Tab bar icons do not care about the RGB parts; only the Alpha. Alpha = 0
means transparent; alpha = 1 means white (when unselected) or blue (when
selected). You can only control the range in between (it's basically like a
"grayscale" image, except in alpha channel instead of RGB). You don't have
control over the colors other than black, white, or gray.
So basically, what you have to do is first make a grayscale (black and white
) image, and then set those black/white values in the alpha channel instead
of in the RGB (RGB will be ignored).
【在 z*y 的大作中提到】 : : and : Thanks. But my images do not contain alpha value.
| z*y 发帖数: 1311 | 10 got it, thank you.
try some website that converts to alpha, works!
image,
a
white
instead
【在 f*******n 的大作中提到】 : Every pixel in a PNG image has an RGBA (red, green, blue, alpha) value. : Alpha controls the transparency of that pixel. In a "normal" (opaque) image, : every pixel has alpha = 1 (not transparent at all). : Tab bar icons do not care about the RGB parts; only the Alpha. Alpha = 0 : means transparent; alpha = 1 means white (when unselected) or blue (when : selected). You can only control the range in between (it's basically like a : "grayscale" image, except in alpha channel instead of RGB). You don't have : control over the colors other than black, white, or gray. : So basically, what you have to do is first make a grayscale (black and white : ) image, and then set those black/white values in the alpha channel instead
| e***t 发帖数: 78 | 11 请问您在哪个网站转的?谢谢!
【在 z*y 的大作中提到】 : got it, thank you. : try some website that converts to alpha, works! : : image, : a : white : instead
|
|