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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:41:27+00:00 2026-06-09T08:41:27+00:00

I have an image and I would like to have it so when I

  • 0

I have an image and I would like to have it so when I click on a section of the image, only that section highlights. At present to test this, I have set up an application and placed an image view on the back. I just created an image and wrote 1,2,3 and 4 on it. I then used a UIView to draw a horizontal and vertical line through the image

I have set up a on tap gesture listener and that prints out which section I have hit. Code below

- (void)handleSingleTap:(UITapGestureRecognizer *)recognizer
{
    // Get the location of the touch
    CGPoint touchPoint = [recognizer locationOfTouch:0 inView:[self view]];

    if(touchPoint.x > 10 && touchPoint.x < 160)
    {

        if(touchPoint.y > 30 && touchPoint.y < 220)
        {
            NSLog(@"Button 1");


        }else if(touchPoint.y > 220 && touchPoint.y < 430){
            NSLog(@"Button 3");
        }

    }else if(touchPoint.x > 160 && touchPoint.x < 310)

    {
        if(touchPoint.y > 220 && touchPoint.y < 430)
        {
           NSLog(@"Button 4");
        }else if(touchPoint.y > 30 && touchPoint.y < 220){
            NSLog(@"Button 2");
        }

    }

   //For debugging
   // NSLog(@"x = %f y = %f", touchPoint.x, touchPoint.y);
}

Now what I want to happen is when I click on a particular section, I want just that part of the image to highlight. Is this possible? At present the workaround I am using is adding 4 buttons on top of the grid which are hidden for normal state, and give them an image for highlighted state like this

[button setBackgroundImage:[UIImage imageNamed:@"highlightImage.png"] forState:UIControlStateHighlighted];

And set the alpha to 0.5 or somewhere around that, so it looks like that section is being highlighted. If this is the only way it can be done, then just leave an answer saying so and I will accept it, but I would prefer a more concrete solution if one is available!! Thanks in advance

Example of image created
enter image description here

  • 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-09T08:41:29+00:00Added an answer on June 9, 2026 at 8:41 am

    Looks like the right approach.

    Maybe you should use less hard coded numbers in your code and implement this functionality on a more general level (e.g., using the frame property of the image view or buttons).

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

Sidebar

Related Questions

I would like to have an AppWidget that designed like this one . Image:
I have an image on my website. I would like when I click it,
I have an image in WPF that I would like to have display different
I have an image within a popup that I would like to be swapped
I have an image. I would like to go over that image, pixel by
how can I do this? I have an image 50x50 and I would like
I would like to have a table header that looks like the image shown
I would like to replace images on click but also have the replaced image
I currently have an ASP.Net Web Form that looks like this: Each section of
I have an array of integers which represent a RGB image and would like

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.