3

I want to create an application in iOS with image edit application with following concepts . When i click a position on image that relavent position should zoom and if i draw a circle on it and it will save to the exact position when closed zoom position

. I have did something using CAShapelayer when i click on image will draw a circle programmatically by below code

. Now work when i click on image will draw a circle perfectly

. But I want, when i click on image it will create a little circle image view and fill with clicked potion of image(zoomed image)

. When I click on that zoomed image view it need to create a circle and close zoom view and also the circle need to show on normal image

. Is any Library available? I hope some one will help to do it.

  (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
    {
        UITouch *touch = [touches anyObject];
        CGPoint touch_point = [touch locationInView:self.view];

        if ([imgVw pointInside:touch_point withEvent:event])
        {
            NSLog(@"point inside imageview");

            CGPoint point = [touch locationInView:self.view];
            NSLog(@"X location: %f", point.x);
            NSLog(@"Y Location: %f",point.y);



            CAShapeLayer *circleLayer = [CAShapeLayer layer];
            // Give the layer the same bounds as your image view
            [circleLayer setBounds:CGRectMake(0.0f, 0.0f, [imgVw bounds].size.width,
                                              [imgVw bounds].size.height)];
            // Position the circle anywhere you like, but this will center it
            // In the parent layer, which will be your image view's root layer
            [circleLayer setPosition:CGPointMake([imgVw bounds].size.width/2.0f,
                                                 [imgVw bounds].size.height/2.0f)];






            // Create a circle path.
            UIBezierPath *path = [UIBezierPath bezierPathWithOvalInRect:
                                  CGRectMake(point.x, point.y, 10.0f, 10.0f)];
            // Set the path on the layer
            [circleLayer setPath:[path CGPath]];
            // Set the stroke color
            [circleLayer setStrokeColor:[[UIColor redColor] CGColor]];
            // Set the stroke line width
            [circleLayer setLineWidth:2.0f];

            [layerArray addObject:circleLayer];         // will push all layer in to array it will help to re edit like undo operation
            [[imgVw layer] addSublayer:circleLayer];    //will add a circle on image

        }
 }
G A
  • 67
  • 2
  • 13
Mohanraj S K
  • 657
  • 4
  • 16

0 Answers0