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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:09:54+00:00 2026-05-24T16:09:54+00:00

I’ve looped through an NSArray of NSDictionary objects that contain the data for several

  • 0

I’ve looped through an NSArray of NSDictionary objects that contain the data for several images to be displayed. This data is then converted into UIImageView objects and added to the current view as subviews. Simple enough! All the images passed in via the array/dict are displayed on the screen as desired, and it works great so far:

for (NSDictionary *caseData in caseImages) { // caseImages is the array
    UIImage *caseImage = [UIImage imageNamed:[caseData objectForKey:@"image_file"]];
    UIImageView *caseView = [[UIImageView alloc] initWithImage:caseImage];
    caseView.frame = CGRectMake([[caseData objectForKey:@"position_x"] intValue], [[caseData objectForKey:@"position_y"] intValue], [[caseData objectForKey:@"size_w"] intValue], [[caseData objectForKey:@"size_h"] intValue]);
    [self.view addSubview:caseView ];
}

However, now I need to take this a step further, and implement a touchUpInside event handler that can be attached to each of these UIImageView objects if possible, in such a way that the handler method can further animate/manipulate each UIImageView, ideally centering and enlarging the touched image, and simply fading the rest of the images out.

Where I’m stuck is on how to successfully add the touch events, with the ability to reference the image that case touched, as well as the rest of the untouched images if possible, and then apply the proper transition animations to each image respectively.

I have seen examples similar to the snippet below, but I haven’t been able to get it working:

[caseView addTarget:self action:@selector(spotlightCase) forControlEvents:UIControlEventTouchUpInside];

Although, had I actually gotten it to work, I’d still feel a bit left in the dark about how to successfully reference each and every UIImageView created from the loop, so each image could be animated/manipulated properly according to which one had indeed been touched. Would I need a new array property in my view controller that would hold the pointers for each UIImageView object added to the view? Is none of this even accomplishable with UIImageViews? I saw someone mention using custom UIButton objects, but I thought that might be equally complicated/impossible seeing as I also need to animate the size and location of the images anyway.

Any chance you can shed some insight on how to implement all of the tricky endeavors above?

Thanks!

  • 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-24T16:09:55+00:00Added an answer on May 24, 2026 at 4:09 pm

    One way to do this is to add a UIButton to your view controller’s view for each image and set the backgroundImage property to the [UIImage imageNamed:] inside your loop. You can set a generic selector to the target of each button just like in your second snippet. I have used a similar trick before and set the tag property of the button to identify the index of the button that was pressed. If you also add a colon to the end of your @selector(spotlightCase:) your method will also get passed the id of the object that called it. Your method definition would be:

    - (void) spotlightCase:(id) sender;
    

    This is where you can use the sender.tag to control your logic.

    Hope this helps

    Dave

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.