Objective c 获取阵列中uiimageview的中心

Objective c 获取阵列中uiimageview的中心,objective-c,ios4,uiimageview,nsmutablearray,nsarray,Objective C,Ios4,Uiimageview,Nsmutablearray,Nsarray,我在NSMutableArray中有一堆uiimageview,uiimageview正在为视图制作动画。但我不知道如何获取任何图像视图的当前位置 for(int i = 0; i < [myArray count]; i++){ UIImageView *temp = [myArray objectAtIndex:i]; NSLog(@"POSITION:%@",temp.center.x); } for(int i=0;i

我在NSMutableArray中有一堆uiimageview,uiimageview正在为视图制作动画。但我不知道如何获取任何图像视图的当前位置

for(int i = 0; i < [myArray count]; i++){
UIImageView *temp = [myArray objectAtIndex:i];
NSLog(@"POSITION:%@",temp.center.x);
}
for(int i=0;i<[myArray count];i++){
UIImageView*temp=[myArray objectAtIndex:i];
NSLog(@“位置:%@”,温度中心x);
}

我看不出你为什么不能得到那个号码。但是
temp.center.x
是一个
CGFloat
,如果要打印它,必须使用
%f
而不是
%@
。这可能是您的问题?

您是否绝对确定阵列中有有效的UIImageView

尝试:

for(int i=0;i<[myArray count];i++){
UIImageView*temp=[myArray objectAtIndex:i];
NSLog(@“%@”,温度);
}
您应该在日志中看到类似的内容:

<UIImageView: 0x...>


Dude的可能重复项甚至不接近我要问的内容它返回null,而且如果我尝试使用该浮点值进行比较(即,如果该位置在某个范围内),它仍然无法识别它
<UIImageView: 0x...>