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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:44:32+00:00 2026-05-19T01:44:32+00:00

Objective C answers are fine too. This is in C# Monotouch. Currently I am

  • 0

Objective C answers are fine too. This is in C# Monotouch.

Currently I am using this code to add 2 gestures (left / right) to my WebView. Works fine.

Can I combine this into less code though to indicate that both gestures go to the same action?

//LEFT
UISwipeGestureRecognizer sgr = new UISwipeGestureRecognizer ();
sgr.AddTarget (this, MainViewController.MySelector);
sgr.Direction = UISwipeGestureRecognizerDirection.Left;
sgr.Delegate = new SwipeRecognizerDelegate ();
this.View.AddGestureRecognizer (sgr);

//RIGHT
UISwipeGestureRecognizer sgrRight = new UISwipeGestureRecognizer ();
sgrRight.AddTarget (this, MainViewController.MySelector);
sgrRight.Direction = UISwipeGestureRecognizerDirection.Right;
sgrRight.Delegate = new SwipeRecognizerDelegate ();
this.View.AddGestureRecognizer (sgrRight);
  • 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-19T01:44:32+00:00Added an answer on May 19, 2026 at 1:44 am

    You could try this version, which is shorter and takes advantage of C# lambdas:

    UISwipeGestureRecognizer sgr = new UISwipeGestureRecognizer ();
    sgr.Action = delegate {
       // Your handler goes here
    });
    sgr.Direction = UISwipeGestureRecognizerDirection.Left | 
                    UISwipeGestureRecognizerDirection.Right;
    this.View.AddGestureRecognizer (sgr);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Objective-C Answers are fine, I am using MonoTouch for reference. I am writing text
(Note: The code here is Monotouch/C#, however Objective-C Answers are welcome!) Im using AVPlayer
I'm using this code: set_post_thumbnail_size(726, 200, true); My objective is to input any size
I am using monotouch but will accept Objective-C answers. I'd like a visual indication
EDIT/ANSWER: this works fine in mongoose >= 3.0 also I have a mongoose schema
It seems a lot of Objective-C code is using Singleton nowadays. While a lot
I create a circle with a nice shadow with this code (I use MonoTouch.net
For this example, I am working with objective-c, but answers from the broader C/C++
I'm using Monotouch to develop an iPhone application. I'm aware there are answers out
Possible Duplicate: What is the Java equivalent of Objective-C's NSDictionary? I've seen other answers

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.