[英]Why am I am getting the warning “Multiple methods named 'center' found”
I only get this warning if I import my helper class (#import "JLHelper.h"). 如果导入我的助手类(#import“ JLHelper.h”),则只会收到此警告。
An example of the where the warning occurs... 警告发生位置的示例...
[[subViews objectAtIndex:i] center].y+translation.y)];
I understand that it is telling me that the compiler sees more than one method named center, but center is declared in the framework in CLRegion.h. 我知道这是在告诉我,编译器可以看到多个名为center的方法,但是center是在CLRegion.h的框架中声明的。
Why would the compiler see more than one method in this case? 在这种情况下,为什么编译器会看到多个方法? Is it a problem to be concerned about, and if so how do I track down and resolve it.
这是一个值得关注的问题吗?如果是的话,我该如何跟踪并解决它。
Thanks, 谢谢,
John 约翰
Problem solved, thanks to Eric! 问题解决了,多亏了埃里克! Here is a more extensive look at my code after it was fixed
修复后,我对代码进行了更广泛的研究
NSArray *subViews = [self subviews];
UIImageView *bottomResizer;
int count = [subViews count];
for (int i =count-1; i>=0; i--) {
if([[subViews objectAtIndex:i] tag] == 301) {
bottomResizer = (UIImageView*)[subViews objectAtIndex:i];
[bottomResizer setCenter:CGPointMake([bottomResizer center].x, [bottomResizer center].y+translation.y)];
}
}
Looks like you need to cast the object so it knows what center you mean... 看起来您需要投射对象,因此它知道您的意思是什么中心...
[((OBJECT_TYPE*)[subViews objectAtIndex:i]) center].y+translation.y)];
Where OBJECT_TYPE is a CLRegion Object 其中OBJECT_TYPE是CLRegion对象
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.