How to set BarChartView barColor? - objective-c

This is the UI Picture
I don't know how to set a lightgray color
I try to use
self.chartView.drawGridBackgroundEnabled = YES;
self.chartView.gridBackgroundColor = [UIColor grayColor];
But the effect is not what I want

You have to enable BarShadow Property as mention below:
_barChartView.drawBarShadowEnabled = YES;
By default its showing GrayColor for customize Shadow Color you have to set shadow color in BarChartDataSet like below :
BarChartDataSet *set1 = [[BarChartDataSet alloc] initWithValues:Values];
set1.barShadowColor = [UIColor lightGrayColor]; // Set your custom color here
Hope this will help you to show your Custom color in bar shadow.

You can use
UIColor *color = ...;
color = [color colorWithAlphaComponent:0.5f];
OR You can try with RGB values.
[UIColor colorWithRed:(160/255.0) green:(97/255.0) blue:(5/255.0) alpha:1]

Related

label text in ios with more brigtness

i m creating an image gallery with label on top of it where the label background is opaque.i was successful in placing the text above the label.the problem is textcolor is not bright enough.my text color is white..but it lacking the brightness which is required could u guys help me out below is the code.
label=[[UILabel alloc]init];
label.frame = CGRectMake(column*248, row*175+415, 242, 70);
label.text=[story objectAtIndex:i];
label.font=[UIFont boldSystemFontOfSize:21];
label.alpha=0.5;
label.backgroundColor=[UIColor blackColor];
//label.backgroundColor=[UIColor clearColor];
label.textColor=[UIColor whiteColor];
label.textAlignment=UITextAlignmentLeft;
label.numberOfLines=2;
[view1 addSubview:label];
Your alpha value for the entire label is 0.5. This also dampens the font color. You could simply set the background of the label to a color with alpha value 0.5, the text should still be alpha 1.0 then.
label.alpha = 1.0; // is already the default
label.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];

Change background color with a variable iOS

I want to change the background color of my label with a variable how can I do that ?
This is my code but I'd like to have a variable instead of 'redColor'
[publisherLabel setBackgroundColor:[UIColor redColor]];
Variable with color from an RGBA value.
UIColor *myColor = [UIColor colorWithRed:100.0/255.0 green:101.0/255.0 blue:102.0/255.0 alpha:1.0]];
You can also use HEX if you want:
#define HEXCOLOR(c) [UIColor colorWithRed:((c>>24)&0xFF)/255.0
green:((c>>16)&0xFF)/255.0
blue:((c>>8)&0xFF)/255.0
alpha:((c)&0xFF)/255.0];
// usage:
UIColor* c = HEXCOLOR(0xff00ffff);

AQGridViewCell transparent background

I have a problem customizing my AQGridViewCell. I'd like to have the whole cell having a transparent background, but the following inside of the initWithFrame:reuseIdentifier does not do the job:
self.backgroundView.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
self.backgroundColor = [UIColor clearColor];
self.backgroundView.opaque = NO;
self.contentView.opaque = NO;
self.opaque = NO;
Does anyone have an idea how to solve this?
Thank you very much for any response!
EDIT
I found this, but this does not seem to work either:
https://github.com/AlanQuatermain/AQGridView/pull/108#issuecomment-3610006
The tip in your link was half way there. The following did the trick for me:
self.contentView.backgroundColor = nil;
self.backgroundColor = nil;
And you need to put this in your custom AQGridViewCell's initWithFrame:reuseIdentifier:. It's a bit puzzling that you have to set two properties but at least it works.
Also note that you also need to set the background color to clear for all text labels you might have, e.g:
captionLabel.backgroundColor = [UIColor clearColor];
Setting label background to nil doesn't help - it comes out as black.

Objective c pagecontrol background color

I have a scrollview with a pagecontrol, when i change her color, my pagecontrol dissapear.
UIColor *col = [UIColor colorWithRed:14.5 green:35.6 blue:72.9 alpha:1];
self.pageControl.backgroundColor = col;
The RGB values are supposed to be between 0 and 1. (See the docs). So you're setting the background color to fully opaque white here.
UIColor *col = [UIColor colorWithRed:14.5 green:35.6 blue:72.9 alpha:1];
If you have the RGB ASCII values 0 to 255
you can specify it as
UIColor *col = [UIColor colorWithRed:(255/255) green:(0/255) blue:(0/255) alpha:1]; // This represent Red color

UILabel sizeWithFont: problem. Clipping italic text

I have created a UILabel that displays a single large character. Even with clipsToBounds = NO; I still get clipping.
See link: http://img341.imageshack.us/img341/5310/screenshot20100814at243.png
I used the following code:
CGSize fBounds = [myLabel.text sizeWithFont:cFont];
To get what should be the bounding rectangle of the font. And the label is drawn with:
myLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 280, 300)];
myLabel.clipsToBounds = NO;
myLabel.numberOfLines = 1;
myLabel.textAlignment = UITextAlignmentCenter;
myLabel.adjustsFontSizeToFitWidth = YES;
myLabel.minimumFontSize = 10;
myLabel.text = #"A";
myLabel.font = [UIFont fontWithName:#"CourierNewPSMT" size:300];
myLabel.textColor = [UIColor blackColor];
myLabel.backgroundColor = [UIColor colorWithRed:1 green:.5 blue:0 alpha:.5];
In the image below, the size returned from sizeWithFont is rendered by the semi-transparent blue rectangle overlay. As you can see, with an italic font (in this case Verdana-BoldItalic), the character extends past what sizeWithFont returns. Further, the UILabel's frame (the orange color) also clips the character. Thoughts? Maybe I could override some text drawing routine. Also, not sure if this is the same problem as here:
UIButton.titleLabel clipping text problem
Use attributed text + indent...
Looks like this is an apple problem. Ended up doing custom drawing with CoreText.