objective c - Modify colors of buttons connected to a IBoutletCollection not working -
objective c - Modify colors of buttons connected to a IBoutletCollection not working -
i have code should modify colors of 24 buttons, connected iboutletcollection :
in .h file:
@property (nonatomic, strong) iboutletcollection(uibutton) nsarray *buttons;
in .m file:
for (uibutton *label in buttons) { label.layer.borderwidth = 1.5f; label.layer.bordercolor = (__bridge cgcolorref)([uicolor colorwithred:87.0/255.0 green:49.0/255.0 blue:42.0/255.0 alpha:1]); label.layer.backgroundcolor = (__bridge cgcolorref)([uicolor colorwithred:134.0/255.0 green:98.0/255.0 blue:98.0/255.0 alpha:1]); }
the iboutletcollection's connected existing 24 buttons in view, in grayness color, when run function modify colors of buttons go white color, how can solve this?
use
[[mybutton layer] setborderwidth:2.0f]; [[mybutton layer] setbordercolor:[uicolor colorwithred:87.0/255.0 green:49.0/255.0 blue:42.0/255.0 alpha:1].cgcolor]; [mybutton settitlecolor:[uicolor colorwithred:150.0/256.0 green:150.0/256.0 blue:150.0/256.0 alpha:1.0]]
objective-c iboutlet iboutletcollection
Comments
Post a Comment