UIImageView Border Color

BlueChips23 picture BlueChips23 · Oct 26, 2012 · Viewed 15.9k times · Source

I have the following code:

UIColor *borderColor = [UIColor colorWithRed:182 green:10 blue:96 alpha:1.0];
[viewImage.layer setBorderColor:borderColor.CGColor];
[viewImage.layer setBorderWidth:3.0];
[productView addSubview:viewImage];

where viewImage is my UIImageView and productView is my UIView.

I want to get this color enter image description here, but all I am getting is this color enter image description here. I tried different values, and all the colors that I am getting is either white, red, black, yellow, or blue. I can't get any other colors, doesn't matter what values I enter. I tried colorWithHue:Saturation:Brightness and I have the same issue.

I am using this on iOS 6 SDK.

What am I doing wrong and how can I fix it?

Answer

Bajaj picture Bajaj · Oct 26, 2012
#import <QuartzCore/QuartzCore.h>

[imageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];