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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:28:00+00:00 2026-05-24T05:28:00+00:00

I know there are similar posts on Stack but nothing that I’ve found has

  • 0

I know there are similar posts on Stack but nothing that I’ve found has helped me find a solution.

  • I have a scrollview added to a UIView.
  • I have added a UIButton to the same UIView above the scrollview.

    1. I want the UIButton to respond to a touchUp and fire an event.
    2. If someone DRAGS on the UIButton I want it to pass the event to the scrollView and drag the UIScrollView without firing the button event.

I know how to pass on a touch with hitTest returning the scrollview but this stops anything getting to the UIButton.

I don’t want to add the UIButton to the UIScrollView.

Does anyone have a proposed solution?

  • 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-24T05:28:02+00:00Added an answer on May 24, 2026 at 5:28 am

    As explained in this answer, a UIButton or other UIControl that is a subview of a scroll view will automatically respond to taps while letting the scroll view handle drags. However, buttons that are subviews of the scroll view will also move with the scrolled content, rather than remaining in the same position on the screen as the content scrolls beneath them. I assume this is why you don’t want to put the buttons into the scroll view.

    If that’s the case, you can get the desired behavior with one more step. Put all your buttons into a UIView that is a subview of the scroll view, then in the scrollViewDidScroll method of the scroll view’s delegate, set that view’s frame.origin to the scroll view’s contentOffset. I just implemented this in my app and it’s working great, without having to do any subclassing or get involved with the responder chain or touch events.

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

Sidebar

Related Questions

I know there have been some similar questions to this, but they haven't helped
So I know there have been a number of similar posts, but I think
I've seen a few similar posts to my problem, but none that have helped
there were a few question similar to mine on the stack but none that
I know there are similar, more complex posts around, but I just can't get
Yes I know there has been similar posts to this however after looking through
I know there are other posts similar to this one, but none of them
I know there are numerous posts out there for a similar problem, but mine
I know there are a few posts with the similar title, but they don't
I know there are many other posts on here with similar questions, but 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.