1

I have a uidatepicker in Time Mode I want to add a component with string value into it I think I have 2 approaches:

1.using a custom pickerview

2.adding component to uidatepicker of my Mode Time(I don't know the possibility)

if it is possible to add a component to a ready built in uidatepicker of TimeMode I think it is awesome because it is more easy than building a customepickerview

Here is the TimeMode:

TimePicker.datePickerMode=UIDatePickerModeTime;
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"HH:mm"];

is it possible to add a component here?or I should build a picker view from scratch? I know how to build from scratch I just want to know if it is possible to add a component to datepicker

enter image description here

Nickool
  • 3,662
  • 10
  • 42
  • 72

1 Answers1

0

No, you can't to that, the UIDatePickerView doesn't allow access to its underlying UIPickerView, in order to do that you must create you custom version on to of UIPickerView.

ararog
  • 1,092
  • 10
  • 18
  • are you abslutely sure about this? I have read something about calender in hebrew here http://stackoverflow.com/questions/10004778/how-do-i-rewrite-the-uidatepicker-component?rq=1 and the second answer seems resonable to define a class but I don't know – Nickool Apr 07 '13 at 11:14
  • If you read the entire discussion you will see people ending up with a UIPickerView based approach, not a UIDatePicker, the first challenge is get a reference to its underlying UIPickerView but a property for it doesn't exist according to its class reference. – ararog Apr 07 '13 at 11:19
  • I know but I think when it is possible to rewrite for a uipickerview it would be possible to rewrite for a uidatepicker too because both of them are built ins of the objective-c. – Nickool Apr 07 '13 at 11:25
  • But unfortunatelly UIDatePicker is a decorator of UIPickerView, which hides all implementation details around its underlying control, this make task of create a extended version very hard to archive. – ararog Apr 07 '13 at 11:38