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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:30:07+00:00 2026-05-22T01:30:07+00:00

I have a UIView (lets call it myView), inside a UIScroller. myView has elements

  • 0

I have a UIView (lets call it myView), inside a UIScroller.

myView has elements that can be dragged on it.

When one of these elements are touched, the scroller is locked, to prevent the whole thing from scrolling. The elements have exclusiveTouch = YES. I need the whole thing to scroll when just myView is touched.

I had this working with touchesBegan, touchesMoved, etc., but I am converting this class to gestures. The new class has two gestures attached to it: UIPanGestureRecognizer and UITapGestureRecognizer. Something like:

 UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] 
           initWithTarget:self action:@selector(drag:)];
 [panGesture setMaximumNumberOfTouches:1];
 [panGesture setDelegate:self];
 [myView addGestureRecognizer:panGesture];
 [panGesture release];


 UITapGestureRecognizer *singleTap =  [[UITapGestureRecognizer alloc] 
                initWithTarget:self 
                action:@selector(tapAdd:)];
 [singleTap setDelegate:self];
 [singleTap setNumberOfTapsRequired:1];
 [myView addGestureRecognizer:singleTap];
 [singleTap release];

When this class used the old methods (touchesBegan, etc.), I simply forwarded the touches using something like

[self.nextResponder touchesBegan: touches withEvent:event]; 

but how do I do that using gestures? I mean, the UIPanGestureRecognizer will, in my case, run a method called drag: and this method receives a gesture… how do I forward the touch to its scroller parent, so the whole thing scrolls?

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-22T01:30:08+00:00Added an answer on May 22, 2026 at 1:30 am

    It’s possible you could set up a protocal to make a delegate of your view.

    In your header, set up

    @protocol MyViewDelegate
    - (void)drag;
    @end
    
    @interface ....... {
        id <MyViewDelegate> delegate;
    }
    @property (nonatomic, assign) id delegate;
    @end
    

    You’ll have to synthesize delegate in the implementation file.
    In the scroller class, you will have to use the protocol

    @interface Scroller ....... <MyViewDelegate> {
    

    In that implementation file, make sure to put myView.delegate = self; when initializing it and add - (void)drag { and do what you want in there. If you need more info, you can of course assing the method in your protocol to be something like - (void)dragWithEvent:(UIEvent *)event or something similar.

    Then when you call drag: in myView, you can forward this to the protocol method by calling [self.delegate dragWithEvent:event];.

    I realize this is a bit extensive to get your scroller to scroll, but it will forward the message like you want.

    It’s also possible that you could add the gestures to the scroller rather than to myView, then forward all touches in the touchesBegan method and let the scroller handle it directly

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

Sidebar

Related Questions

I have a UIView that has several UIImageViews as subviews. Each of these subviews
I have a UIView subclass ( CustomView for purposes of this question) that has
I have one single MainViewController which has of course it's one main UIView. I
I have a UIView subclass that has the following in drawRect: for(int j=0; j<[myArray
In my app I have a custom UIView subclass (let's call it MyView) which
I have a UIView that will eventually contain about 2 screens worth of information.
I have a UIView with a UITableView for a subview. The UIView has an
I have a UIView with a navigation bar. How can I hide the navigation
I have a UIView subclass that draws itself when -drawRect: is called. It only
I have a UIView that contains a number of CALayer subclasses. I am using

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.