UIImageView数组帧相等

时间:2013-07-11 16:05:35

标签: objective-c cocoa uiimageview nsmutablearray

我有两个NSMutableArray个,其中包含UIImageView个。我想知道如何检查UIImageView s的帧是否等于Objective-C中另一个数组的帧。这有功能吗?

1 个答案:

答案 0 :(得分:0)

假设数组长度相同,称为array1array2

__block BOOL equal = YES;
[array1 enumerateObjectsUsingBlock:^(UIImageView *imageView, NSUInteger idx, BOOL *stop) {
    UIImageView *otherImageView = array2[idx];
    if (!CGRectEqualToRect(imageView.frame, otherImageView.frame))
    {
        equal = NO;
        *stop = YES;
    }
}];

if (equal) {
    // do stuff
}