I immerse myself in iOS development and I play with touch events. I have a class with a name UIPuzzlePiecethat is a subclass UIImageView, and it represents puzzle objects that you can move around the screen. My goal is to transfer puzzles on the screen with my finger.
I currently have touchBegan and touchsMoved events implemented inside the class UIPuzzlePiece...
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event touchesForView:self] anyObject];
CGPoint cgLocation = [touch locationInView:self];
[self setCenter:cgLocation];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event touchesForView:self] anyObject];
CGPoint cgLocation = [touch locationInView:self];
[self setCenter:cgLocation];
}
, , - CGPoint UIPuzzlePiece, , . , [self setCenter:cgLocation] UIPuzzlePiece . , , , . , , , UIPuzzlePiece.
?
!