How do I MOVE a circle drawn in a subclass of UIView by overwriting the method "drawRect"??
- by Christoph v
hi, I'm trying to figure out what i'm doing wrong but i just don't get it. Here is what i want to do:
I want to draw a circle somewhere on the screen of the iphone and then i want the circle always to be displayed at the position where the user currently taps on the screen.
I started by creating a subclass of UIView and adding the following lines into the "drawRect" method:
- (void)drawRect:(CGRect)rect {
//Create the main view!
CGContextRef mainscreen = UIGraphicsGetCurrentContext();
//Draw the dot
//will be a circle cause rectangle is a square
CGRect dotRect = CGRectMake(50, 80, 100, 100);
[[UIColor blueColor] set];
CGContextStrokeEllipseInRect(mainscreen, dotRect);
CGContextFillEllipseInRect(mainscreen, dotRect);
}
The appears just fine but now i have no idea how to make it move around on the screen i've tried serveral things and nothing worked pls help!