I have searched the entire internet (maybe I am exaggerating a little) for a tutorial on how to put a DatePicker into a UIPopover and display that in an iPad application. I have tried creating a viewcontroller, placing the datepicker in the view controller and then:
self.popover = [[UIPopoverController alloc] initWithContentViewController:sa];
(sa is the name of the viewcontroller i created), but this doesn't work, and the app crashes. Can anyone help?
Now since you have tagged iPhone It can clearly be assumed that you are trying to use
UIPopoverController
iniPhone
ButUIPopoverController
is available only foriPad
. So it is resulting in a crash since iPhone doesn't recognize that controller.Try with below code. It will work fine:
Objective-C
Swift3