2012-08-28 3 views
1

uitouches로 CGRect를 어떻게 움직일 수 있습니까? 누구든지 아이디어가 있다면 설명해주십시오. 당신이 그것을 코딩 할 필요가 있으므로 다른 곳으로 한 곳으로 자른 이미지를 이동해야 내 이해에 따라UITouches로 CGRect를 어떻게 움직일 수 있습니까?

[cropRect setFrame:CGRectMake(<new x coordinate>, <new y coordinate>, width, height)] 
+0

당신은 무엇을 달성하기를 원합니 까? – IronManGill

+0

@Shehbaz가 선을 그어야합니까? – Spynet

+0

직사각형을 옮기고 싶습니다. 이것은 올바른 코드입니다. CGRect cropRect = [myPath bounds]; \t \t \t // 망막 \t \t cropRect = CGRectMake (cropRect.origin.x-10 cropRect.origin.y, cropRect.size.width * 1.5 * 1.5 cropRect.size.height); –

답변

0

당신은 사각형의 프레임을 재설정해야 물건 ...

-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { 
    UITouch *touch = [[event allTouches] anyObject]; 
    CGPoint location = [touch locationInView:touch.view]; 
    cloud.center = location; 
} 

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { 
    [self touchesBegan:touches withEvent:event]; 
} 

여기에 구름이있는 UIImageView가 당신은 .... 그것으로 자른 이미지를 만들 수 있습니다 닿은

cloud.image=croppedImage; //[you must assign this first...] 

나는 그것이 당신을 돕기를 희망한다. ...

1

안녕 :

if(areaSelected) 
     return; 
    UITouch *mytouch=[[touches allObjects] objectAtIndex:0]; 
    [myPath addLineToPoint:[mytouch locationInView:self]]; 

[self setNeedsDisplay]; 
+0

고맙습니다 spynet 그것은 저를 진짜로 돕는다 aloot :) –

+0

차가운 친구 묻는 질문을 ... – Spynet

관련 문제