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

  • Home
  • SEARCH
  • 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 8260549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:07:31+00:00 2026-06-08T03:07:31+00:00

I have a UIDatePicker in my app and although I change the date selected

  • 0

I have a UIDatePicker in my app and although I change the date selected in the simulator, when I NSLog the datePicker.date, it outputs the current date rather than the one I selected.

Here is an extract of my code: (where the picker is generated)

self.pickerView = [[UIDatePicker alloc] initWithFrame:pickerFrame];
//self.pickerView.frame = pickerFrame;

self.pickerView.datePickerMode = UIDatePickerModeDate;

actionSheet = [[UIActionSheet alloc] initWithTitle:nil 
                                                         delegate:nil
                                                cancelButtonTitle:nil
                                           destructiveButtonTitle:nil
                                                otherButtonTitles:nil];

[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];

[actionSheet addSubview:pickerView];

UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Done"]];
closeButton.momentary = YES; 
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];

[closeButton addTarget:self action:@selector(dismissActionSheet) forControlEvents:UIControlEventValueChanged];

[pickerView addTarget:self action:@selector(pickerChange) forControlEvents:UIControlEventValueChanged];

[actionSheet addSubview:closeButton];
[actionSheet setBounds:CGRectMake(0, 0, 320, 251)];

pickerView.maximumDate = [NSDate dateWithTimeIntervalSinceNow:315360000];
pickerView.minimumDate = [NSDate dateWithTimeIntervalSinceNow:-315360000];

Then in my pickerChange function:

-(void)pickerChange{
    NSLog(@"DEBUG: Picker Value Changed");
    NSLog(@"%@",self.pickerView.date );
}

The output of that NSLog is always the CURRENT DATE rather than the date that is selected in the UIDatePicker. Not sure why this is, because from what I can tell, the date property should display what is selected, not the current date (or what was originally selected prior to the user changing the value).

Any help would be appreciated. (message me if you need further info). Thanks! I’m sure it must be something I’ve overlooked whilst in a rush.

  • 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-08T03:07:32+00:00Added an answer on June 8, 2026 at 3:07 am

    Ok. I have managed to find the answer – I’m posting it so that if any others have a similar problem, they can fix it.

    I had to modify the pickerChange function to include the sender – one would expect however that any other type of reference to the datePicker would have the same effect. Here’s what it now looks like:

    -(void)pickerChange:(UIDatePicker*) datePicker{
        myDate = datePicker.date;
    }
    

    It seems that this was the only way to get around the problem, rather than referencing ‘pickerView’ (which was declared in the header file) you must reference the sender in this way.

    Would be interesting to see if anyone else has come across this type of problem (or similar).

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

Sidebar

Related Questions

I have two UIDatePicker controls in my app, one configured with UIDatePickerModeDate and one
I have used UIDatePicker in my app. I want to (actually have to) change
I have an app which saves text and the date from a UIDatePicker and
I have two UIDatePicker in a view. One for getting Date and Another for
I am using the jquery ui datepicker in my app. I have created an
I have a UIDatePicker that well, allows you to select a date (not time).
I have a UIDatePicker and I get the date using this: NSDate *pickerDate =
I have a jQuery UI datepicker that, when you click on a date, clears
I've created a UIDatePicker in my app and I also have support for several
I am using UIDatePicker controller to choose the date in iPhone app. Now, i

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.