我已经尝试过这段代码但不能正常工作。在 UISlider 的值更改时我调用了这个方法......
@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;
// Do any additional setup after loading the view, typically from a nib.
}
-(void)sliderValueChanged:(UISlider*)slider
{
[_colorLabel setBackgroundColor:[UIColor colorWithRed:_r.value green:_g.value blue:_b.value alpha:1]];
}
如果有人有任何想法,请帮助..