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

  • Home
  • SEARCH
  • 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 8765973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:25:46+00:00 2026-06-13T16:25:46+00:00

SOLVED: see comments for what the problem was I am implementing a subclass on

  • 0

SOLVED: see comments for what the problem was

I am implementing a subclass on UIScrollView which will be a horizontally scrolling row of subviews/”cells”. Basically a horizontally scrolling “table view” like element. Each of the subviews/”cells” in the UIScrollView content view have a UIGestureRecognizer attached to them so that when a person touches one of them, the UIGestureRecognizer will trigger.

The problem is that when a person has scrolled away from the contentView origin, i.e., the UIScrollView returns a contentOffset where x is other than 0, any of the new subviews/”cells” that scroll in from the right do not trigger the UIGestureRecognizer when touched. All the subviews DO have their UIGestureRecognizer.

Example, let’s say I am display a row of 80×80 icons and my contentSize is 1600,80 for a row of 20 icons. The UIScrollView is 320,80 so it will show 4 of the icons. The initial 4 icons are touchable and the UIGestureRecognizer fires on each one. The user scrolls to the left, i.e., new icons come in from the right. These new icons (Subviews) are created and added in to the contentView I use in the UIScrollView the same way as the original 4. But the new icons (subviews) that were not in the original bounds do not trigger. I implement my own queue/dequeue of the subviews analogous to what a tableview does so if I have scrolled over by place #15, none of the original icons (subviews) is even in the contentView as the subviews are recycled (and old UIGestureRecognizers removed and new ones attached when it is pulled off the queue and reused) and none of these are touchable and trigger the UIGestureRecognizer.

HOWEVER, if the user then scrolls back to the beginning, even though those cells are newly added to the contentView, they ARE touchable as long as their bounds are within the original frame of the UIScrollView and the UIView contentView I used to aggregate inside the scroll view. So it seems that it is dependent on the frame of each subview and whether or not it lies within the frame of the scrollview.

Everything displays fine — as it scrolls the contentOffset changes and I remove and add subviews. It is just the UIGestureRecognizers attached to each subview that are not triggering and are position dependent on being within the original bounds of the Scrollview before it starts scrolling.

I’ve been scratching my head on this all day, and half a day yesterday) and narrowing it down to being position dependent on not something else.

I would post code but am not sure what to post as there is a lot of code that runs 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-13T16:25:47+00:00Added an answer on June 13, 2026 at 4:25 pm

    I had subclassed UIView, added it inside UIScrollView and the gesture recognizers of my subclassed UIView’s subviews were not firing – except for the ones that were initially visible as before any scrolling.

    The simple fix was to add the UIView’s subview directly to the UIScrollView instead of my subclassed UIView. Before I was doing

        // add to view
        [self addSubview:imageView];
    

    so I fixed it with

        // add to view - we're adding to the superview directly
        [self.superview addSubview:imageView];
    

    This way I could still keep the logic that populates my UIScrolView in a separate class.

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

Sidebar

Related Questions

Solved: The problem was: wrong version of Java. See my comments. Hi all, using
Problem Solved - See bottom for solution notes I'm trying to build a simple
Problem solved, see below Question I'm working in Flex Builder 3 and I have
(Problem solved now, see answers below) Hello, in my app I am trying to
[EDIT: Problem solved. Please see my answer below.] In my app I call the
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
I can't see this in the docs, but I presume it's a solved problem.
** SOLVED ** (see comments) I'm updating a ProgressBar (declared in the Activity's XML
[SOLVED] See my answer below. I am trying to use stringstream (named ss) to
UPDATE The issue is solved, all the code you can see works. Hello! I

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.