PDA

View Full Version : Iphone generate deprecated warnning for CGColorCreateGenericRGB().




hemalimojidra
Nov 13, 2008, 06:00 AM
I am developing simple application on Quartz (iphone) to load 4 layer at time..
i have override awakeFromNib() method in my LayerView.h file..
It is giving me warning that it is deprecated to os..
and i want CGColorRef object..than how i can get..



hemalimojidra
Nov 14, 2008, 04:10 AM
I am developing simple application on Quartz (iphone) to load 4 layer at time..
i have override awakeFromNib() method in my LayerView.h file..
It is giving me warning that it is deprecated to os..
and i want CGColorRef object..than how i can get..

CGColorCreateGenericRGB() is not available with iPhone Os ..So Iam geting
deprecated warning ...But Got Solution..see Bellow


IN MY mainView.h

In Method-
(void)awakeFromNib
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
float black1[4] = {0.0, 0.0, 0.0, 1.0};
CGColorRef black = CGColorCreate(colorSpace, black1);
CALayer *needleLayer = [CALayer layer];
[needleLayer setFrame:CGRectMake(0.0, 0.0, [self frame].size.width/2, [self frame].size.height/2)];

[needleLayer setMasksToBounds:YES];
[needleLayer setBackgroundColor:black];
[needleLayer setDelegate:self.layer];

[needleLayer setNeedsDisplay];
[[self layer] addSublayer:needleLayer];
}