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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:18:03+00:00 2026-05-22T16:18:03+00:00

I created a really simple app with a controlPage with three images. Everytime I

  • 0

I created a really simple app with a controlPage with three images. Everytime I click on the dots at the base the pages changes. Everything works. The code I used is

@implementation myShareViewController

@synthesize  gestureStartPoint;

-(IBAction) changePage {
    switch ([pageControl currentPage]) {
    case 0:
        NSLog(@"changePage: In case 0");
        [view2 removeFromSuperview];
        [view3 removeFromSuperview];
        [[self view] addSubview:view1];
        break;
    case 1:
        NSLog(@"changePage: In case 1");
        [view1 removeFromSuperview];
        [view3 removeFromSuperview];
        [[self view] addSubview:view2];
        break;
    case 2:
        NSLog(@"changePage: In case 2");
        [view2 removeFromSuperview];
        [view1 removeFromSuperview];
        [[self view] addSubview:view3];
        break;

    default:
        break;
}
}

Then I added the following code to get the gestures (swipes)

#pragma mark -
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    UITouch *touch = [touches anyObject];
     gestureStartPoint = [touch locationInView:self.view];
}
 -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint currentPoisition = [touch locationInView:self.view];

CGFloat deltaX = fabsf(gestureStartPoint.x - currentPoisition.x);
CGFloat deltaY = fabsf(gestureStartPoint.y - currentPoisition.y);

if (deltaX >= kMinimumGestureLength && deltaY <= kMaximumVariance) {
    NSLog(@">> Begin >> Hor. Swipe detected. We are now in the page: %i", [pageControl currentPage]);
    [self changePage];
    NSLog(@">> End   >> Hor. Swipe detected. We are now in the page: %i", [pageControl currentPage]);

}
else if (deltaY >= kMinimumGestureLength && deltaX <= kMaximumVariance) {
    NSLog(@"Ver. Swipe detected");
}
}

Now the gestures are recoginzed alright, but the pages don’t changes.

Update with solution

UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; 
[self.view addGestureRecognizer:swipeRight]; 
[swipeRight release];

and then add a:

- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer 
{ 
    if (recognizer.direction == UISwipeGestureRecognizerDirectionRight)  
    {
        // advance page
    }
}
  • 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-22T16:18:04+00:00Added an answer on May 22, 2026 at 4:18 pm

    So I assume in your touchesMoved callback you are seeing something like:

    Begin >> Hor. Swipe detected. We are now in the page: 0

    End >> Hor. Swipe detected. We are now in the page: 0

    This is because you aren’t actually telling the PageControl to change pages in this code. When you are calling changePages, you are telling the view to update to reflect the current state of the PageControl.

    To have this work you will need to increment or decrement the currentPage property of the PageControl based on the user swipe.

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

Sidebar

Related Questions

I have really simple few lines of Facebook app, using the new Facebook API:
I try to launch really simple Ruby on Rails app on VDS. I use
I created simple REST web app that would create Excel file and put into
The issue is simple really. Instead of creating folders in Visual Studio, I create
I'm really new to Python and Django. I created a class in Python that
i've created a dll for gamemaker. dll's arrays where really slow so after asking
Since Microsoft created MSTest, I've been using it for unit testing. I never really
I'm new to designing OO systems. I have a simple Flash Cards app where
I've been researching writing an app for iPhone. I really like the look of
I am currently trying to write a very simple app that sends an object

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.