Saturday, December 21, 2013

In TableView, click TextField trigger DatePicker

posts by DuoBiRenXiong edited 2011-09-13 13:38:15
I put a table in the database, a message is displayed in a TableView in vertical, there are various types of fields, including the date type, in order to facilitate fill in the date, I want to fill in that date back TextField add a DatePicker, when I Select a date on the DatePicker, it will automatically fill in the date TextField, and how to achieve it? Or when you click the TextField, replace the keyboard into a DatePicker? Or any other good suggestions can achieve what I want the same? For example chant?

Ask you ......
Reply:
I went out of the ......
Reply:
In the click event in TextField, remove the pop-up keyboard, and then on the view to add a TableView DatePicker enough ah.
Reply:
reference to the second floor happyboyxq reply:
click event in TextField inside, remove the pop-up keyboard, and then on the view to add a TableView DatePicker enough ah.


Oh, there are no related articles or examples?
Reply:
I step forward, click TextField, can pop up DatePicker in TextField event in DatePicker can get the value, the question now is how this value to TextField ah? ? ? ?
Here is part of the code:
 
UIDatePicker * dp;

@ Synthesize dp = _dp;

Here is the cell
tableviewself.dp = [[[UIDatePicker alloc] initWithFrame: CGRectMake (0, 0, 250, 200)] autorelease];

self.dp.datePickerMode = UIDatePickerModeDate;
self.dp.date = [NSDate date];

[Self.dp addTarget: self action: @ selector (changes :) forControlEvents: UIControlEventValueChanged];

self.dp.tag = 101;

cell.inputField.inputView = self.dp;

Here are the events

- (Void) changes: (id) sender {
NSString * str = [NSString stringWithFormat: @ "% @", [self.dateFormat stringFromDate: self.dp.date]];

}



Is how the value of str to the cell

No comments:

Post a Comment