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 9319457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:23:24+00:00 2026-06-19T03:23:24+00:00

I have multiple UIImageView subclasses: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { for (UITouch *touch in

  • 0

I have multiple UIImageView subclasses:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

    for (UITouch *touch in touches) {

        CGPoint _location = [touch locationInView:touch.view];
        [self processTouch:_location];
    }


}





-(void)processTouch:(CGPoint)location {



    DLog(@"location: %f .. bounds: %f : %f" ,location.x, [twoThirdOfTheWayCoordinateX floatValue], [oneThirdOfTheWayCoordinateX floatValue]);



    if(CGRectContainsPoint(self.frame, location)) {

        DLog(@"1");

        if(location.x > [twoThirdOfTheWayCoordinateX floatValue]){

            [self oneStar];

        } else if (location.x < [oneThirdOfTheWayCoordinateX floatValue]) {

            [self zeroStars];

        } else if( [twoThirdOfTheWayCoordinateX floatValue] >= location.x && location.x >= [oneThirdOfTheWayCoordinateX floatValue]){

            [self halfStars];

        }

    }

}

The DLog(@”1″); never gets called. The UIImageView Subclass is in the middle of the iphone screen. when it is in the top left corner, this code works.

NSLog:
-[Star processTouch:] location: 44.000000 .. bounds: 33.333332 : 16.666666

I assume the problem is because:

if(CGRectContainsPoint(self.frame, location)) {

never gets called.

Why is that so? the first DLog gets called.

Code i use to initialize the instance:

self.instance = [[Class alloc] initWithFrame:CGRectMake(10, 10, 50 , 50)];
self.instance.userInteractionEnabled = YES;
self.instance.image = [UIImage imageNamed:@"0-0.png"];
[self.view addSubview: self.instance];
[self.instance setNeedsDisplay];
  • 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-19T03:23:25+00:00Added an answer on June 19, 2026 at 3:23 am

    replacing self.frame with self.bounds fixed the issue.

    kudos to august on #iphonedev on freenode.

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

Sidebar

Related Questions

I have a single image that needs to be placed on multiple UIImageView. I
I have multiple UIImageView's within a UIView . These UIImageViews have been transformed. When
I have multiple UIImageView added into the main view, each UIImageView is displayed in
I have created a subclass of UIImageView and I am handling the touches for
I have a UIImageView, above which I have multiple markers. All the markers are
I have a UIImageView on which I am adding multiple UIImages on multiple click
I have a UIView and i have multiple UIImageView's as its subview. I have
I have a ScrollView with multiple UIImageView s in it which load .jpg images.
I'm trying to have multiple UIImageView 's each with two buttons - A Take
i have created multiple insances in my h file IBOutlet UIImageView *imageView; IBOutlet UIImageView

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.