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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:37:01+00:00 2026-05-26T08:37:01+00:00

I have a little problem with my UIPickerView animation. I did set up the

  • 0

I have a little problem with my UIPickerView animation.
I did set up the animation so when I click a button the UIPickerView will slide up and after another click it will slide down. But I hit the problem on if. I tried to set up a new settings bool and set it’s value after each animation, so the if was just checking for the bool. I’m not sure if I did explained it well, but maybe you get the idea from the code.
But unfortunately it’s not working… Any ideas?

- (void)viewDidLoad
{
    [super viewDidLoad];

    settings = [NSUserDefaults standardUserDefaults];
    [settings setBool:NO forKey:@"pickerShown"];
    [settings synchronize];
}


- (IBAction)showPicker:(id)sender {

    CGRect rect = countryPicker.frame;
    CGPoint origin = CGPointMake(0, 510); // Some off-screen y-offset here.

    rect.origin = origin;
    countryPicker.frame = rect;


    if ([settings boolForKey:@"pickerShown"] == YES) {


        // Perform transform to slide it off the screen.
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        countryPicker.transform = CGAffineTransformMakeTranslation(0, -0); // Offset.
        [UIView commitAnimations];
        [settings setBool:NO forKey:@"pickerShown"];
        [settings synchronize];

    } else if ([settings boolForKey:@"pickerShown"] == NO) {


        // Perform transform to slide it onto the screen.
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        countryPicker.transform = CGAffineTransformMakeTranslation(0, -266); // Offset.
        [UIView commitAnimations];
        [settings setBool:YES forKey:@"pickerShown"];
        [settings synchronize];

    }
}

EDIT:

Just found the solution…
If anyone’s interested – here it is:

The h. file:

.
.
.
{
BOOL pickerShown;
}
.
.
.

The .m file:

- (void)viewDidLoad
{
    [super viewDidLoad];

    CGRect rect = countryPicker.frame;
    CGPoint origin = CGPointMake(0, 510); // Some off-screen y-offset here.

    rect.origin = origin;
    countryPicker.frame = rect;
pickerShown = NO;


}


- (IBAction)showPicker:(id)sender {


    if (pickerShown == NO) {


        // Perform transform to slide it onto the screen.
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1];
        //[UIView setAnimationDidStopSelector:@selector(hidePicker)];
        countryPicker.transform = CGAffineTransformMakeTranslation(0, 0); // Offset.
        [UIView commitAnimations];
        [self performSelector:@selector(hidePicker) withObject:nil afterDelay:1];

    } else if (pickerShown == YES) {

        //countryPicker.hidden = NO;
        // Perform transform to slide it onto the screen.
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1];
        countryPicker.transform = CGAffineTransformMakeTranslation(0, -266); // Offset.
        [UIView commitAnimations];
        countryPicker.hidden = NO;

    }
}
  • 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-26T08:37:01+00:00Added an answer on May 26, 2026 at 8:37 am

    Just found the solution… If anyone’s interested – here it is:

    The h. file:

    .
    .
    .
    {
    BOOL pickerShown;
    }
    .
    .
    .
    

    The .m file:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        CGRect rect = countryPicker.frame;
        CGPoint origin = CGPointMake(0, 510); // Some off-screen y-offset here.
    
        rect.origin = origin;
        countryPicker.frame = rect;
    pickerShown = NO;
    
    
    }
    
    
    - (IBAction)showPicker:(id)sender {
    
    
        if (pickerShown == NO) {
    
    
            // Perform transform to slide it onto the screen.
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:1];
            //[UIView setAnimationDidStopSelector:@selector(hidePicker)];
            countryPicker.transform = CGAffineTransformMakeTranslation(0, 0); // Offset.
            [UIView commitAnimations];
            [self performSelector:@selector(hidePicker) withObject:nil afterDelay:1];
    
        } else if (pickerShown == YES) {
    
            //countryPicker.hidden = NO;
            // Perform transform to slide it onto the screen.
            [UIView beginAnimations:nil context:NULL];
            [UIView setAnimationDuration:1];
            countryPicker.transform = CGAffineTransformMakeTranslation(0, -266); // Offset.
            [UIView commitAnimations];
            countryPicker.hidden = NO;
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a little problem. I have some text 23%, but I need some
i have little problem how i will recognize which item was clicked with OnClickEvent.
I have little problem in my iPhone application code but can not identify. please
have a little problem with this code: UITableViewCell *cell = (UITableViewCell *)[[button superview] superview];
Hey most of my issue has been solved but i have little problem This
I have a little problem with my click event. I have an AJAX function
I have a little problem. I have a program that will draw wave function
I have a little problem with simulating a click with javascript. I'm aware of
I have a little problem with the following code. When I click Send it
I have little problem with a replacement of a little part in an url.

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.