Debugger show some value in color . Please what am I doing wrong
@synthesize textLabel;
@synthesize textField;
@synthesize sliderRed;
@synthesize sliderGreen;
@synthesize sliderBlue;
- (void)dealloc
{
    [textLabel release];
    [super dealloc];
}
- (IBAction)updateLabel
{
    NSString * textValue = [textField text];
    float red = [sliderRed value]/255.f;
    float green = [sliderGreen value]/255.f;
    float blue = [sliderBlue value]/255.f;
    UIColor *textColour = [[UIColor alloc]initWithRed:red green开发者_运维知识库:green blue:blue alpha:1.0];
    [textLabel setText:textValue];
    [textLabel setTextColor:textColour];
}
I guess sliderRed, sliderGreen and sliderBlue are UISlider instances? What are their min/max values? If you left it at default 0.0 to 1.0 then this code would give you some really low values:
float red = [sliderRed value]/255.f;
float green = [sliderGreen value]/255.f;
float blue = [sliderBlue value]/255.f;
UIColor's method you use takes float parameters from 0.0 to 1.0 so simply passing it the slider values without dividing them would work.
And don't forget to put [textColour release]; at the end of that method or you will be leaking a new UIColor instance every time the method gets called.
Nothing wrong on your codes. maybe something wrong in other places.
Try to replace this line:
UIColor *textColour = [[UIColor alloc]initWithRed:red green:green blue:blue alpha:1.0];
to
UIColor *textColour = [UIColor redColor];  
And check if the redColor works. if not, so it might something wrong in your other codes.
Try adding [textLabel setNeeedsDisplay] after you've changed the drawing attributes.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论