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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:34:51+00:00 2026-06-01T10:34:51+00:00

I am developing one applciation.In that I need to display the 9 UIImageViews in

  • 0

I am developing one applciation.In that I need to display the 9 UIImageViews in another UIImageView.And if we click on any image then identify that selected UIImageView and change the image of that selected UIImageView.Next time also need to do the same but we need to display the previous selected image with new changed image.For that I written the code like

for (int h=0; h<8; h++) 
      {
          int x=[[questions.marker_left objectAtIndex:h] intValue];
          int y=[[questions.marker_top objectAtIndex:h] intValue];
          img3=[[UIImageView alloc]initWithFrame:CGRectMake(x,y, 30, 30)];
          img3.userInteractionEnabled=YES;
          img1.userInteractionEnabled=YES;
          img3.tag=h;
          //img2.backgroundColor=[UIColor greenColor];
          img3.image=[UIImage imageNamed:@"PINpurple.png"];
          tap5=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(calculate:)];
          tap5.delegate=self;
          [img3 addGestureRecognizer:tap5];
          [img1 addSubview:img3];

      }

  -(void)calculate:(UITapGestureRecognizer*)recognizer
   {
      NSInteger i=(recognizer).view.tag;
     NSString *str=[questions.result objectAtIndex:i];
      NSLog(@"%@",str);
     if([str isEqualToString:@"true"])
        {
          img3.image=[UIImage imageNamed:@"PINgreen.png"];
        }
     else
        {
          img3.image=[UIImage imageNamed:@"PINred.png"];
          }
   }

The selected image will be changed but previous UIImageView will get the old image after selecting the next UIImageView.So please help me, how to do this?

  • 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-01T10:34:53+00:00Added an answer on June 1, 2026 at 10:34 am
        //Edit In calculate function
        -(void)calculate:(UITapGestureRecognizer*)recognizer
        {
          NSInteger i=(recognizer).view.tag;
    
          //Detect selected UIImageView
          UIImageView *selectedImageView=(UIImageView*)recognizer.view;
    
          NSString *str=[questions.result objectAtIndex:i];
    
          NSLog(@"%@",str);
    
         if([str isEqualToString:@"true"])
            {
              selectedImageView.image=[UIImage imageNamed:@"PINgreen.png"];
            }
         else
            {
              selectedImageView.image=[UIImage imageNamed:@"PINred.png"];
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing one application for iphone using phone gap.I that I need to display
I'm developing a small utility application that needs to detect whether another one has
i am developing one application with map view i need display the weather depends
I am developing one application that requires records from Addressbook , I need all
I am developing one application and in that application I need to implement push
I am developing iPhone application and In that application I've one TableViewController , and
I'm developing an application for an internal customer. One of the requirements is that
I'm developing an application that will need to communicate with itself running on different
I'm developing a small tray-icon application for Windows and I need to display non-intrusive
I am developing an iPhone application that allows to basically click through a series

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.