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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:52:06+00:00 2026-06-09T20:52:06+00:00

I have achieved to show the datepicker inside the popover, doing it programmatically as

  • 0

I have achieved to show the datepicker inside the popover, doing it programmatically as it is shown in UIDatePicker in UIPopover.

But I have been trying to do it in interface Builder, I already made a View Controller named DatePickerViewController.m with a DatePicker in it and its corresponding IBoulet

#import <UIKit/UIKit.h>

@interface DatePickerViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIDatePicker *birthdayDatePicker;

@end

DatePicker inside DatePickerViewController.m in StoryBoard

Then I need this to be shown in a popover when the Birthday text field is being edited. so I use the following code

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
    //Assign DatePicker to Birthday TextField
    //build our custom popover view
    DatePickerViewController* popoverContent = [[DatePickerViewController alloc] init];
    //resize the popover view shown
    //in the current view to the view's size
    popoverContent.contentSizeForViewInPopover = CGSizeMake(320, 216);

    // dismiss existing popover
    if (self.popoverControllerBirthday)
    {
        [self.popoverControllerBirthday dismissPopoverAnimated:NO];
        self.popoverControllerBirthday = nil;
    }

    //create a popover controller with my DatePickerViewController in it
    UIPopoverController *popoverControllerForDate = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
    //Set the delegate to self to receive the data of the Datepicker in the popover
    popoverControllerForDate.delegate = self;
    //Adjust the popover Frame to appear where I want
    CGRect myFrame =textField.frame;
    myFrame.origin.x = 260;
    myFrame.origin.y = 320;

    //Present the popover
    [popoverControllerForDate presentPopoverFromRect:myFrame 
                                          inView:self.view 
                        permittedArrowDirections:UIPopoverArrowDirectionDown 
                                        animated:YES];
    self.popoverControllerBirthday = popoverControllerForDate;
    return NO; // tells the textfield not to start its own editing process (ie show the keyboard)

}

And I also import the custom DatePickerViewController in my current ViewController

#import "DatePickerViewController.h"

But it is not showing the datepicker inside the popover.

enter image description here

Does anybody know what could be happening?

  • 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-09T20:52:08+00:00Added an answer on June 9, 2026 at 8:52 pm

    Solved

    All I have to do is instantiate the StoryBoard Date Picker View Controller like :

    ...
    DatePickerViewController* popoverContent = [[DatePickerViewController alloc] init];
    
    popoverContent =[[UIStoryboard storyboardWithName:@"MainStoryboard"
                                             bundle:nil]
                   instantiateViewControllerWithIdentifier:@"DatePickerVC"];
    //resize the popover view shown
    //in the current view to the view's size
    popoverContent.contentSizeForViewInPopover = CGSizeMake(320, 216);
    ...
    

    where the identifier is set in StoryBoard Attributes Inspector

    Where to set the View controller Identifier

    and now it is shown

    DatePicker from DatePickerViewController is now showed

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

Sidebar

Related Questions

I have been trying very hard to achieve rounded corners with IE6+jquery ui tabs.
I have an ArrayList and want to show items present in the arraylist inside
I found a tool on Zend site. But it is only show who have
I need to used dynamic order query in mysql and i have successfully achieved
All source files seem to have compiled fine. However, since I achieved that, I
I have something I am trying to achieve. I have a web application running
I'm trying to achieve the following thing: Have different types of markers on my
Basically I have 2 buttons that when hovered show/hide 2 hidden unordered lists so
I have a fair amount of Facebook development experience, but this had made me
I have the following script to validate my form. It is working fine but

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.