科里森,但其只工作了1个图像如何在for循环
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint p = [touch locationInView:self.view];
if (CGRectContainsPoint(CGRectMake(myImage1.frame.origin.x, myImage1.frame.origin.y, myImage1.frame.size.width, myImage1.frame.size.height), p))
{
[pieMenu showInView:self.view atPoint:p];
}
}
这将工作与图像一般碰撞无论是
[self addImageSubViewAtX:160.0 atY:190.0];
OR
[self addImageSubViewAtX:90.0 atY:140.0];
但不一起
这是方法由您定义
- (void)addImageSubViewAtX:(CGFloat)x atY:(CGFloat)y {
CGRect myImageRect1 = CGRectMake(x, y, 30.0f, 30.0f);
myImage1 = [[UIImageView alloc] initWithFrame:myImageRect1];
[myImage1 setImage:[UIImage imageNamed:@"status_finish.gif"]];
[self.view addSubview:myImage1];
}
我认为你需要这个如果对于这两个图像,对吗?所以,把另一个如果可能解决 if(CGRectContainsPoint(CGRectMake(myImage1.frame.origin.x,myImage1.frame.origin.y,myImage1.frame.size.width,myImage1.frame.size .height),p)) – vodkhang 2010-07-14 04:45:04
我做过但没有工作:(任何想法 – ram 2010-07-14 06:09:06