I reached to show the datepicker inside the popover, doing it programmatically, as shown in the UIDatePicker in UIPopover .
But I tried to do this in the Builder interface, I already created a View Viewer named DatePickerViewController.m with DatePicker in it and its corresponding IBoulet
#import <UIKit/UIKit.h>
@interface DatePickerViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIDatePicker *birthdayDatePicker;
@end

Then I need this to appear in the popover when the "Birthday" text box is edited. so i use the following code
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{
DatePickerViewController* popoverContent = [[DatePickerViewController alloc] init];
popoverContent.contentSizeForViewInPopover = CGSizeMake(320, 216);
if (self.popoverControllerBirthday)
{
[self.popoverControllerBirthday dismissPopoverAnimated:NO];
self.popoverControllerBirthday = nil;
}
UIPopoverController *popoverControllerForDate = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
popoverControllerForDate.delegate = self;
CGRect myFrame =textField.frame;
myFrame.origin.x = 260;
myFrame.origin.y = 320;
[popoverControllerForDate presentPopoverFromRect:myFrame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
self.popoverControllerBirthday = popoverControllerForDate;
return NO;
}
And I also import the custom DatePickerViewController into my current ViewController
#import "DatePickerViewController.h"
But it does not display the datepicker inside the popover.

Does anyone know what could happen?
source
share