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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:35:06+00:00 2026-05-30T10:35:06+00:00

I am using iOS 5 to implement an app. In this app I have

  • 0

I am using iOS 5 to implement an app.

In this app I have 4 button, each button triggers an animation to unhide a UIView. However, if I press a button and then another, the view that appeared first should disappear and the view for the new button would appear.

I have this working so far. But if the user taps two buttons rapidly it will display the two views. How can I insure that only once touch event is processed?

The action for the button is something like:

- (void)buttonPressed:(id)sender
{
    MenuButton *aButton = (MenuButton *)sender;
    switch (aButton.tag) {
        case 0:
            if (displayingView && currentlyDisplayingView != picker1)
                [self toggleView:currentlyDisplayingView atIndex:currentIndex];
            [self toggleView:picker1 atIndex:aButton.tag];
            currentlyDisplayingView = picker1;
            currentIndex = aButton.tag;
            break;
        case 1:
            if (displayingView && currentlyDisplayingView != picker2)
                [self toggleView:currentlyDisplayingView atIndex:currentIndex];
            [self toggleView:picker2 atIndex:aButton.tag];
            currentlyDisplayingView = picker2;
            currentIndex = aButton.tag;
            break;
        case 2:
            if (displayingView && currentlyDisplayingView != picker3)
                [self toggleView:currentlyDisplayingView atIndex:currentIndex];
            [self toggleView:picker3 atIndex:aButton.tag];
            currentlyDisplayingView = picker3;
            currentIndex = aButton.tag;
            break;
        default:
            break;
    }
    NSLog(@"Pressed %@",[buttonNames objectAtIndex:aButton.tag]);
}

And the animation code:

- (void)toggleView:(UIView *)picker
             atIndex:(NSInteger)index
{
    if (picker) {
        picker.hidden = NO;
        [UIView animateWithDuration:0.5 
                         animations:^{
                             picker.alpha = abs(picker.alpha - 1);
                             CGRect rect = picker.frame;
                             if (rect.size.height == 0){
                                 rect.size.height = 76;
                             } else if (rect.size.height == 76) {
                                 rect.size.height = 0;
                             }
                             picker.frame = rect;
                             for (int i = index+1; i < [viewButtons count]; i++) {
                                 UIButton *aButton = [viewButtons objectAtIndex:i];
                                 CGRect frame = aButton.frame;
                                 if (rect.size.height == 0){
                                     frame.origin.y -= 75;
                                 } else if (rect.size.height == 76) {
                                     frame.origin.y += 75;
                                 }
                                 aButton.frame = frame;
                             }
                         }
                         completion:^(BOOL success){
                             if (picker.alpha == 0){
                                 picker.hidden = YES;
                             } else if (picker.alpha == 1) {
                                 picker.hidden = NO;
                             }
                             displayingView = !displayingView;
                         }];
    }
}
  • 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-30T10:35:08+00:00Added an answer on May 30, 2026 at 10:35 am

    Call beginIgnoringInteractionEvents before calling animateWithDuration, and call endIgnoring... in the completion handler.

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

Sidebar

Related Questions

I'm using AFNetworking for my iOs app. I need to implement a search-suggest like
I was trying to implement in-app purchase. I am using ios 5.0 beta and
I currently have an iOS app that allows people to submit content to our
I'm trying to post a link + status through my app, using this "popup"
Possible Duplicate: UISlider and UIScrollView using iOS SDK 4.3. I've found when I have
Using this guide I have created a static library (let's call it AppCore )
I'm trying to implement this (Configuring Sockets for VoIP Usage) using this (CocoaAsyncSocket). To
I have already implemented multitouch image rotation using standard iOS graphics library (Core Graphics).
I have this weird problem.. I'm building an in-house app that should register all
I am trying to implement a channel vocoder using the iOS Accelerate vDSP FFT

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.