I use the following code to display a UIDatePicker
in a UIPopover
, which is displayed when the user clicks the UIButton
button.
The problem is that it is displayed in an uncomfortable position, and I want to add a UIToolBar
above the datePicker
, where there is extra space. This will be the cancel
and done
button. How can i do this? The button with which it is displayed is Date of Birth
.
- (IBAction)dateOfBirthButtonPressed:(id)sender{ UIViewController* popoverContent = [[UIViewController alloc] init]; UIView *popoverView = [[UIView alloc] init]; popoverView.backgroundColor = [UIColor blackColor]; UIDatePicker *datePicker=[[UIDatePicker alloc]init]; datePicker.frame=CGRectMake(0,44,320, 216); datePicker.datePickerMode = UIDatePickerModeDateAndTime; [datePicker setMinuteInterval:5]; [datePicker setTag:10];

source share