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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:57:27+00:00 2026-06-15T18:57:27+00:00

I add a UIDatePicker as input view to UITextField UIDatePicker *oBirth; NSDateFormatter *dateFormat; _editingField

  • 0

I add a UIDatePicker as input view to UITextField

UIDatePicker    *oBirth;
NSDateFormatter *dateFormat;

_editingField = [[UITextField alloc] initWithFrame : CGRectMake(80, 12, 215, 25)];    
dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat : @"dd/MM/yyyy"];

oBirth = [[UIDatePicker alloc] initWithFrame : CGRectMake(0, 0, 120, 45)];
oBirth.date = [dateFormat dateFromString : sField];
NSLog(@"%@", oBirth.subviews);
[oBirth addTarget : self
           action : @selector(updateDate:)
 forControlEvents : UIControlEventValueChanged];
[oBirth addTarget : self
           action : @selector(dismissDate:)
 forControlEvents : UIControlEventTouchUpOutside];
[oBirth setDatePickerMode : UIDatePickerModeDate];
_editingField.tag = 1;
_editingField.inputView = oBirth;

How can I dismiss the UIDatePicker without creating an invisible view ?

  • 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-15T18:57:28+00:00Added an answer on June 15, 2026 at 6:57 pm

    Try this

    [_editingField resignFirstResponder];
    

    Edit

    For dismissDate not being called.

    Remove this piece of code

    [oBirth addTarget : self
               action : @selector(dismissDate:)
     forControlEvents : UIControlEventTouchUpOutside];
    

    And add this

         // single tap gesture recognizer
            UITapGestureRecognizer *tapGestureRecognize = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissDate:)];
            tapGestureRecognize.numberOfTapsRequired = 1;
            [self.view addGestureRecognizer:tapGestureRecognize];
    

    Your callback

    - (void)dismissDate:(UIGestureRecognizer *)gestureRecognizer {
        NSLog(@"Resign your responder");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I add webview and navigationbar inside my view controller . Web view is display
Where is it proper to add an UIDatePicker? Should I add it in viewDidLoad?
I have created a UIPickerView and I want to add an overlay view to
I need to add custom validation(I think) for validating input from an user. Here's
i am new to iPhone development. I want to add a UIDatePicker when textfield
I need to add items to a UIDatePicker , but instead of adding dates:
I need to add a UIDatePicker subview on a button click to my main
I add my url xxx/getjson.php to a webhook and once a person signup, it
The .add method appends components to the end of another component. I'm trying to
I add a EditText into a Linearlayout, for each ,I set a picture as

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.