Well you could create a custom UIView
and overwrite it’s drawRect
method to draw the circle. The drawRect
method would then look like this:
- (void)drawRect:(CGRect)rect
{
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(ctx, [[UIColor redColor] CGColor]);
CGContextFillEllipseInRect(ctx, self.bounds);
}
Don’t forget to set the views background color to the clear color.
To handle the movement, add a gesture recognizer to the custom view (for you possibly a UIPanGestureRecognizer
) and handle its events (there are plenty of examples on how to do this).
2
solved How to draw a circle and move it / drag it on touch in IOS? [closed]