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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:30:46+00:00 2026-05-17T21:30:46+00:00

So, I iterate through a loop and create UIView s which contain UIImageView s

  • 0

So, I iterate through a loop and create UIViews which contain UIImageViews (So that I can selectively show any given part). These UIViews are all stored in a UIScrollView.

I add gesture recognizers to the UIViews in the loop where I created them.

When I run the program, only the items initially visible within the UIScrollView have their gestures recognized. If I scroll over to previously hidden items and then tap on them, nothing happens at all (the gesture is never recognized or attempted to be).

Initialization code:

UITapGestureRecognizer* gestRec = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
  gestRec.delegate = self;

  [imageholder addGestureRecognizer:gestRec];

Code that deals with the gesture:

- (void)handleGesture:(UIGestureRecognizer *)gestureRecognizer
{
 float count = [self._imageHolders count];
 NSLog(@"handling gesture: %f",count);
 while(count--){
  UIView* object = (UIView*) [self._imageHolders objectAtIndex:count];
 // NSLog(@"Whats going on: %@, %@, %b",object,gestureRecognizer.view, object == gestureRecognizer.view);
  if(object == gestureRecognizer.view){
   object.alpha = .1;
   count = 0;
  }
 // [object release];
 }
}

Any ideas?

—- Update :

I’ve explored a variety of the available functions in scrollview, UIView and the gesture recognizer and have tried messing with the bounds in case something was cut off that way… Interestingly enough, if there is one item only partially visible and you move it over so it’s completely visible, only the portion originally visible will recognize any gestures.

I don’t know enough about how the gesture recognizer works within the UIKit architecture to understand this problem. The Apple example for a scrollview with gestures doesn’t seem to have this problem, but I can’t find any real differences, except that I am nesting my UIImageViews within their own UIViews

  • 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-17T21:30:46+00:00Added an answer on May 17, 2026 at 9:30 pm

    I had a similar problem and found it was caused by adding the sub-views to a top-level view then adding that top-level view to the scroll-view. The top-level view had to be sized to the same dimensions as the contentSize (not the bounds) of the scroll-view otherwise it wouldn’t pass on touch events to its subviews even when they had scrolled into view.

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

Sidebar

Related Questions

I need to create feature which will iterate through all subsites of site collection
I'm trying to create an export Excel/CSV function that will iterate through a custom
If you had to iterate through a loop 7 times, would you use: for
Is there a way to use a foreach loop to iterate through a collection
I need to iterate through the items (strings) in a CComboBox to check which
How do you iterate through every file/directory recursively in standard C++?
Some ways to iterate through the characters of a string in Java are: Using
I'm trying to iterate through an array of elements. jQuery's documentation says: jquery.Each() documentation
I need to iterate through the fields on a table and do something if
What is the best way to iterate through a strongly-typed generic List in C#.NET

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.