Why am I getting the warning "Multiple methods with the name" center "found"

I get this warning only if I import my helper class (#import "JLHelper.h").

An example of where the warning occurs ...

[[subViews objectAtIndex:i] center].y+translation.y)]; 

I understand that he tells me that the compiler sees more than one method called center, but the center is declared in the structure in CLRegion.h.

Why does the compiler see more than one method in this case? This is a problem to worry about, and if so, how to track and resolve it.

Thanks,

John

The problem is solved, thanks to Eric! Here is a more detailed look at my code after fixing it.

 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)]; } } 
0
source share
1 answer

It looks like you need to drop the object so that it knows what center you mean ...

 [((OBJECT_TYPE*)[subViews objectAtIndex:i]) center].y+translation.y)]; 

Where OBJECT_TYPE is a CLRegion object

+3
source

Source: https://habr.com/ru/post/1445819/


All Articles