Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:24:07+00:00 2026-06-12T17:24:07+00:00

I have Several UIImageViews in a NSMutableArray. They are all in the superView. I

  • 0

I have Several UIImageViews in a NSMutableArray. They are all in the superView. I want to check if a UIImageView intersects (collides, hits or touches) another UIImageView in the array. This is what I have been doing but I think there should be a better way.

for (UIImageView *b in _blocks) {
    for (UIImageView *b2 in _blocks) {
        if (CGRectContainsPoint(b2.frame, CGPointMake(b.center.x, b.center.y + b.frame.size.height/2))) {
            // Do something
        }

    }

}

If I want to check if the image view is touching more than 2 views this way, the code is going to get very nasty. Thats why I want to know a better way to do it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:24:09+00:00Added an answer on June 12, 2026 at 5:24 pm

    Do this:

     NSMutableArray *arrIntersect = [NSMutableArray array];
     for (UIImageView *b in _blocks) {
        for (UIImageView *b2 in _blocks) {
             if (b != b2 && CGRectIntersectsRect(b2.frame, b.frame)) {
                if(arrIntersect.count > 2)
                   //count > 2
                else
                   [arrIntersect addObject:b2];
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several instances of a UIImageView that I want to manage dynamically. I
I have several UIImageViews within a UIScrollView that I want to wiggle when the
I have a UIView that has several UIImageViews as subviews. Each of these subviews
I have several xml files with different node structure. I want to extract xml
I have several UIViews and UIImageViews that are loaded inside a UIScrollView. Each page,
I'm creating an app where within a UIView subclass I have several UIImageView 's
I have several problems relating to NSPredicates, here are they; 1.) My code is
I have a UIViewController that instantiates several UIImageViews on the screen. Is it possible
I have a rather basic question. I have several(5) UIImageView images on my screen.
I have several objects in an array. These objects are from a UIImageView subclass.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.