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

  • SEARCH
  • Home
  • 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 7550439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:12:48+00:00 2026-05-30T10:12:48+00:00

Annoying newbie problem here. This variable isPlayerTouchingAnotherPlayer is being set to true as soon

  • 0

Annoying newbie problem here. This variable isPlayerTouchingAnotherPlayer is being set to true as soon as I touch the piece. I’m almost positive I know why but I can’t find a way to display this in log to confirm. I could probably do it by setting different flag numbers for each of the objects but I was hoping there is another way.

The problem is that piece is an object that is also located in p1Array so as soon as I touch it it hits itself and isPlayerTouchingAnotherPlayer is evaluated to true.

Is there a way I could print out the view or image name of the objects touching somehow to confirm this? And furthermore, is there a way to somehow avoid this annoying conflict.

for (int i = 0; i <[p1Array count]; i++) {
    UIImageView *tempP1;
    tempP1 =[p1Array objectAtIndex:i];

    if (CGRectIntersectsRect(piece.frame, tempP1.frame)) {
        NSLog(@"selected piece: %@, touched piece: %@ ", piece, tempP1);
        isPlayerTouchingAnotherPlayer = TRUE;
    }
}
  • 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-05-30T10:12:49+00:00Added an answer on May 30, 2026 at 10:12 am

    why not use fast enumeration and skip the image view you are not interested in checking.

    for (UIImageView *imageView in p1Array) {
        if (imageView == piece)
            continue;
    
        if (CGRectIntersectsRect(imageView.frame, piece.frame)) {
           // do whatever
        }
    }
    

    it seems like you are already printing out the names of the objects touching in the code sample you have provided. if you want to print out specific properties of the objects you can do that to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having an annoying problem with my iPhone app. Whenever I set the optimization
I'm having this annoying problem with Rails 3 (ruby 1.9.2) and nested resources. In
I have a very annoying problem with jQuery and the datepicker from jQuery-UI. Here
An annoying problem I'm having with the modernizr script. This script is supposed to
Having a very annoying problem with passing data between activities. This is the code
Got an annoying problem here. I've got an NHibernate/Forms application I'm working through SVN.
I find it annoying that I can't clear a list. In this example: a
It is really annoying. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new mainForm()); <-- pausing visual studio breaks here.
I have an annoying CSS layout problem. I'm trying to float images on a
I have a rather annoying issue here I can't get my CheckBox CheckedChange event

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.