i have 100 UIViews in UIViewController class . i am dragging a separate imageView over my 100 UIviews.
when touches ended/dragging completed, i need to check, if the dragged image frame touches any of my 100 UIViews frame.
is there any way to check it. I have given tags to my each 100 UiViews.
Is there any easy way to get it the UIView Details.(than 100 开发者_JAVA百科switch conditions).
eg:
CGPoint touchEndpoint = [touch locationInView:self.view];
CGPoint imageEndpoint = [touch locationInView:imageview];
if(CGRectContainsPoint([imageview frame], touchEndpoint))
{
Add your UIViews to an NSMutableArray (myViews in the example) then you can do...
for(UIView *aView in myViews) {
if(CGRectContainsPoint([myView frame], touchEndPoint)) {
//DO STUFF
}
}
精彩评论