Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
- {
- UITouch *touch = [touches anyObject];
- firstTouch = [touch locationInView:self];
- CGSize mySize = CGSizeMake(5, 5);
- UIGraphicsBeginImageContext(mySize);
- CGContextRef ctx = UIGraphicsGetCurrentContext();
- CGContextBeginPath(ctx);
- CGContextSetRGBFillColor(ctx, 1, 0, 0, 1);
- CGContextAddRect(ctx, CGRectMake(0, 0, 5, 5));
- CGContextFillPath(ctx);
- UIImage *redRect = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- UIImageView *redRectView = [[UIImageView alloc] initWithImage:redRect];
- redRectView.center = CGPointMake(firstTouch.x, firstTouch.y);
- [self addSubview:redRectView];
- }
Add Comment
Please, Sign In to add comment