问题
I only get this warning if I import my helper class (#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.
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)];
}
}
回答1:
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
来源:https://stackoverflow.com/questions/11129778/why-am-i-am-getting-the-warning-multiple-methods-named-center-found