1
C4 앱의 캔버스에 42 개의 도형을 추가했습니다. 사용자가 어떤 모양을 터치했는지 어떻게 알 수 있습니까? 다음과 같이C4 모양을 클릭 했습니까?
나는 모양을 추가
#import "C4Workspace.h"
@implementation C4WorkSpace{
C4Shape *greyRect;
}
-(void)setup {
int imageWidth=53.53;
int imageHeight=65.1;
for (int i=0; i<42; i++) {
int xMultiplier=(i)%6;
int yMultiplier= (i)/6;
int xPos=xMultiplier*imageWidth;
int yPos=yMultiplier*imageHeight;
greyRect=[C4Shape rect:CGRectMake(xPos, yPos, imageWidth, imageHeight)];
greyRect.fillColor=[UIColor colorWithRed:0 green:0 blue:0 alpha:0];
greyRect.lineWidth=2;
greyRect.strokeColor=[UIColor colorWithRed:0.7 green:0 blue:0 alpha:1];
[self listenFor:@"touchesBegan" fromObject:greyRect andRunMethod:@"highlightLetter"];
[self.canvas addShape:greyRect];
}
}
-(void)highlightLetter{
C4Log(@"highlightLetter");
}
@end
나는 거의 유일한 [I]를 클릭 RECT가 가지고있는 번호를 알아야합니다.
하지만 라인을 실행 한 후 그에 액세스하는 방법을 모른다 : [self listenFor:@"touchesBegan" fromObject:greyRect andRunMethod:@"highlightLetter"];
어떤 제안?
이것은 트릭을하고 있습니다. 감사!! – suMi