0

i want to take the array of CALAYER:-

CALayer *layer3 = [CALayer layer];
    [layer3 setBounds:CGRectMake(0.0f, 0.0f, 10.0f, 10.0f)];
    [layer3 setCornerRadius:5.0f];
    [layer3 setMasksToBounds:YES];
    [layer3 setBackgroundColor:[[UIColor redColor] CGColor]];

    // Center the layer in the view.
    [layer3 setPosition:CGPointMake(x,y)];
[[self.Image layer3] addSublayer:layer3];

By the above way i had made one point in the image. But i want to draw the 10 point in the image. I want to take the arrary of CALAyer. Please help me .How can i take the array of CALAYER.

Thanks in advance

ios developer
  • 3,363
  • 3
  • 51
  • 111
  • i think you have to store points in array and you can use that number of points whenever its required. – Paras Gandhi Sep 13 '11 at 09:05
  • For how to store CGPoints in array, you can refer this link http://stackoverflow.com/questions/899600/how-can-i-add-cgpoint-objects-to-an-nsarray-the-easy-way – Paras Gandhi Sep 13 '11 at 09:07

1 Answers1

-1
    NSMutableArray *Arr=[[NSMutableArray alloc] init];
    CALayer *layer1 = [CALayer layer];
        [layer1 setBounds:CGRectMake(0.0f, 0.0f, 10.0f, 10.0f)];
        [layer1 setCornerRadius:5.0f];
        [layer1 setMasksToBounds:YES];
        [layer1 setBackgroundColor:[[UIColor redColor] CGColor]];
         [Arr addObject:layer1];
    CALayer *layer3 = [CALayer layer];
        [layer3 setBounds:CGRectMake(0.0f, 0.0f, 10.0f, 10.0f)];
        [layer3 setCornerRadius:5.0f];
        [layer3 setMasksToBounds:YES];
        [layer3 setBackgroundColor:[[UIColor redColor] CGColor]];
        [Arr addObject:layer3];
    CALayer *layer4 = [CALayer layer];
        [layer4 setBounds:CGRectMake(0.0f, 0.0f, 10.0f, 10.0f)];
        [layer4 setCornerRadius:5.0f];
        [layer4 setMasksToBounds:YES];
        [layer4 setBackgroundColor:[[UIColor redColor] CGColor]];
        // [Arr addObject:layer4]; Center the layer in the view.

now take Individual Layer From Array... I Hope It Will Help To You Try Once

Maulik
  • 19,348
  • 14
  • 82
  • 137
Srinivas
  • 983
  • 9
  • 21