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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:20:45+00:00 2026-06-10T19:20:45+00:00

I am using a UIDatePicker in my iPhone project. I want to show the

  • 0

I am using a UIDatePicker in my iPhone project. I want to show the date in the datepicker after I open it and click the “Done” button. I am using this code:

[datePicker addTarget:self action:@selector(changeDate:) forControlEvents:UIControlEventValueChanged]

changeDate is a method I defined somewhere else and I put the corresponding codes of UIControlEventValueChanged in that method. However I want to display the value in the UIDatePicker after I hit the “Done” button even if I haven’t made any changes. How can I do that?

  • 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-10T19:20:47+00:00Added an answer on June 10, 2026 at 7:20 pm

    You can use following code….

    -(void)showDate{
        menu = [[UIActionSheet alloc] initWithTitle:@"Select Date"
                   delegate:self
                   cancelButtonTitle:nil
                   destructiveButtonTitle:nil
                   otherButtonTitles:nil];
    
        datePicker = [[UIDatePicker alloc] initWithFrame:CGRectMake(0.0, 44.0, 0.0, 0.0)];
        datePicker.datePickerMode = UIDatePickerModeDate;
        datePicker.minimumDate = [NSDate date];
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4];
        [dateFormatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]autorelease]];
        [dateFormatter setDateFormat:@"dd MMM yyyy"];
        //[dateFormatter setDateFormat:@"MM/dd/YYYY"];
    
        //[theDatePicker release];
        [datePicker addTarget:self action:@selector(LabelChange:) forControlEvents:UIControlEventValueChanged];
    
    
        dateTool = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
        dateTool.barStyle=UIBarStyleBlackOpaque;
        [dateTool sizeToFit];
        NSMutableArray *barItems = [[NSMutableArray alloc] init];
        UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(DatePickerDoneClick)];
        [barItems addObject:flexSpace];
    
        [dateTool setItems:barItems animated:YES];
        [menu addSubview:dateTool];
        [menu addSubview:datePicker];
        [menu showInView:self.view];
        [menu setBounds:CGRectMake(0,0,320, 464)];
    
    
        //    [self.view addSubview:datePicker];
    
        [datePicker release];
    }
    -(IBAction)DatePickerDoneClick{
        [menu dismissWithClickedButtonIndex:0 animated:YES];
    }
    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
    {
        return 1;
    }
    
    - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{
    
            return [arrTime count];
    
    }
    
    - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
    {
    
            return [arrTime objectAtIndex:row];
    
    }
    
    - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
    
            txtTime.text = [arrTime objectAtIndex:row];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UIDatePicker and I get the date using this: NSDate *pickerDate =
Hi I found the following code from this page JQuery UI DatePicker using 2
I am using UIDatePicker controller to choose the date in iPhone app. Now, i
I'm using ui.datepicker.js and I want to validate the date field to make sure
I am using UIDatePicker in my iPhone application.I have kept a button on clicking
This seems strange... I am using a UidatePicker in an actionSheet. on click of
I am using a Jquery datepicker. I want the button panel to be visible,
I am using jquery ui datepicker icon trigger. I want to give the icon
I am using the jquery ui datepicker inline mode view I want to be
I am using a DatePicker with popups when a user click a textField. However,

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.