Iphone generate deprecated warnning for CGColorCreateGenericRGB().

Discussion in 'iPhone/iPad Programming' started by hemalimojidra, Nov 13, 2008.

  1. macrumors newbie

    Joined:
    Nov 7, 2008
    #1
    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..
     
  2. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #2
    CGColorCreateGenericRGB() get Alternate way in iphone

    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];
    }
     

Share This Page