0
-(IBAction)pickerChanged:(id)sender
{
UIDatePicker *picker = (UIDatePicker *)sender;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
//NSDate *dateSelected is declared in .h file
self.dateSelected = [picker date];
if(self.textField.tag == 101)
self.textField.text = [dateFormatter stringFromDate:self.dateSelected];
nslog(@"date = %@",self.textField.text);
nslog(@"dateSelected = %@",self.dateSelected);
}
textfield.text和日期選擇應該是相同的,但在輸出日誌....如果我得到日期= 2-1-2012我得到dateselected = 1-1-2012 ...和日期被保存爲1-1-2012.i我無法找出問題。DatePicker顯示的日期
它不適合我。 – 2012-03-13 12:45:51