i have tried code not working properly.on value change of uislider called method...
@property (strong, nonatomic) iboutlet uislider *r; @property (strong, nonatomic) iboutlet uislider *g; @property (strong, nonatomic) iboutlet uislider *b; @property (strong, nonatomic) iboutlet uilabel *colorlabel; - (void)viewdidload { [super viewdidload]; _r.minimumvalue=0; _r.maximumvalue=255; _g.minimumvalue=0; _g.maximumvalue=255; _b.minimumvalue=0; _b.maximumvalue=255; // additional setup after loading view, typically nib. } -(void)slidervaluechanged:(uislider*)slider { [_colorlabel setbackgroundcolor:[uicolor colorwithred:_r.value green:_g.value blue:_b.value alpha:1]]; }
please if 1 have idea..
use setting color method as
-(void)slidervaluechanged:(uislider*)slider { float r=[[nsstring stringwithformat:@"%.0f",_r.value] floatvalue]; float g=[[nsstring stringwithformat:@"%.0f",_g.value]floatvalue]; float b=[[nsstring stringwithformat:@"%.0f",_b.value]floatvalue]; uicolor *colortoset=[uicolor colorwithred:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1]; [_colorlabel setbackgroundcolor:colortoset]; }
Comments
Post a Comment