mardi 4 août 2015

Different coordinates while resizing an imageview iOS

I'm trying to resizing an imageview using these functions:

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch* mTouch = [touches anyObject];
    if (mTouch.view == [self Logo_01]) {
        CGPoint cp = [mTouch locationInView:[self view]];
        [[mTouch view]setCenter:CGPointMake(cp.x-xd, cp.y-yd)];
        NSLog(@"questo è x");
        NSLog(@"lalal %f", cp.y);

        if (cp.y > 390) {

            [_Logo_01 setHidden:YES];
        }
        if (cp.y < 130) {
            [_Logo_01 setHidden:YES];
        }
        if (cp.x > 290) {
            [_Logo_01 setHidden:YES];
        }
        if (cp.x < 40) {
            [_Logo_01 setHidden:YES];
        }

    }

when i resize my Logo on the app the image resizes correctly but my center point is wrong

I'm sorry i wronged to post code this is the code that i use to scale my images:

- (IBAction)ScaleImage1:(UIPinchGestureRecognizer *)recognizer
{
    recognizer.view.transform = CGAffineTransformScale(recognizer.view.transform, recognizer.scale, recognizer.scale);
    recognizer.scale = 1;

    CGFloat height = _Logo_01.frame.size.height;
    NSLog(@"SIZE ===== %f", height);
    if (height > 600) {
        [_Logo_01 setHidden:YES];
    }

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire