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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:21:07+00:00 2026-06-09T17:21:07+00:00

Noob working on an application that displays short texts selected at random from an

  • 0

Noob working on an application that displays short texts selected at random from an array–a new text each time the user swipes. I was using “previous” and “next” buttons, and that was working fine. Then I added the swipes, and a right swipe (from left) produced “previous” and a left swipe (from right) produced “next”, but in both cases the animation was a right-to-left swipe. Then I got rid of the buttons entirely and both right and left swipes produced “next”–no way to get “previous”–and again only the right-to-left swipe animation.

Here’s the relevant code from viewDidLoad:

UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(nextHaiku)];
swipeRight.numberOfTouchesRequired = 1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(nextHaiku)];
swipeLeft.numberOfTouchesRequired = 1;
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
[self.view addGestureRecognizer:swipeLeft];

Here’s the relevant code from the “next” method.

-(void)nextHaiku
{
<...a bunch of code setting up the UItextView 'haiku_text'...>

CATransition *transitionR = [CATransition animation];
transitionR.duration = 0.25;
transitionR.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transitionR.type = kCATransitionPush;
transitionR.subtype =kCATransitionFromRight;
transitionR.delegate = self;
[self.view.layer addAnimation:transitionR forKey:nil];
[self.view addSubview:self.haiku_text];
}

And likewise here’s the “previous” method.

-(void)previousHaiku
{
<...a bunch of code setting up the UITextView haiku_text...>
        CATransition *transition = [CATransition animation];
        transition.duration = 0.25;
        transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
        transition.type = kCATransitionPush;
        transition.subtype =kCATransitionFromRight;
        transition.delegate = self;
        [self.view.layer addAnimation:transition forKey:nil];
        [self.view addSubview:self.haiku_text];

And here, just for the sake of thoroughness, is a pic of my connections:

my connections

Any thoughts about what I might be doing wrong?

  • 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-09T17:21:08+00:00Added an answer on June 9, 2026 at 5:21 pm

    In viewDidLoad you are using the same selector nextHaiky for both recognizers when init. This overwrites the bindings you make in IB

    Change the appropriate UISwipeGestureRecognizer init to fix the problem

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

Sidebar

Related Questions

I'm working on an encryption application that for now encrypts text-only files. I need
Another noob question from me. I'm trying to create an application that counts, and
Noob question here! I have an array with hashes that looks like this: arr
Python noob here, Currently I'm working with SQLAlchemy, and I have this: from __init__
I'm a noob working on my first app that consists of the following: Main
Noob here... :) I'm working on a small and personal project that is already
I'm learning Objective-C, noob question. I'm working on a project in Xcode that requires
Noob question alert! I am working on a basic clock that updates every second,
noob question on c#: how to create a one-dimensional dynamic array? And how to
I have never designed a database/data-model/schema from scratch, especially for a web-application. In some

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.