使用UIImageViews的NSArray,如何检查是否有任何视图相交。我的尝试如下。错误显示为"属性'框架'没有找到对象类型' id'"。
- (BOOL)isOverlapping:(UIImageView*)image
{
for (int x = 0; x < objectsArray.count; x++)
{
if([objectsArray[x] isEqual:image])continue;
if([objectsArray[x] isKindOfClass:[UIImageView class]])
if(CGRectIntersectsRect(image.frame, (UIImageView)objectsArray[x].frame))
return true;
}
return false;
}
答案 0 :(得分:1)
尝试在括号周围包裹演员:
((UIImageView *)objectsArray[x]).frame