开发者

array of caLayer in iphone

开发者 https://www.devze.com 2023-04-04 16:57 出处:网络
i want to take the array of CALAYER:- CALayer *layer3 = [CALayer layer]; [layer3 setBounds:CGRectMake(0.0f, 0.0f, 10.0f, 10.0f)];

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 t开发者_如何转开发he 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


    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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号