i want to make a texField , when i click on it , a UIDatePickerView appear …
I maked this
@interface getDatesAndPriceController : UIViewController {
UIDatePicker * deparatureDate ;
UITextField *deparatureField;
}
@property(retain,nonatomic) IBOutlet UIDatePicker * deparatureDate ;
@property(retain,nonatomic) IBOutlet UITextField *deparatureField;
in .m
- (void)viewDidLoad
{
[super viewDidLoad];
deparatureField.inputView=deparatureDate;
// Do any additional setup after loading the view from its nib.
}
But i don’t work 🙁 . When i run the UIdatePicker directly appear and when i click the textField the keyboard appear . Help please
I have to answer to show what I am saying. The
UIDatePickeris not a subview to the view. So if you wish you can even create it programmatically. I also added a toolbar with a done button which is necessary in dismissing the keyboard. This will be the text field’s input accessory view. Once you have set up all the outlets correctly, the date picker will show up instead of the keyboard.