I'm trying to simply place the TIME from a UIDatePicker into a UITextField.
I am beating my head against the wall looking at the code for the last week.
The code I have is currently:
-(void) createDatePicker
{
[myDatePicker = [UIDatePicker alloc] awakeFromNib];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString* currentTime = [dateFormatter stringFromDate:[NSDate date]];
[dateFormatter release];
}
In my head the 7th line's "currentTime" should hold the date now in a string. However, in another method when I try to set the text of the UITextField to currentTime, nothing happens.
- (IBAction) buttonPress: calculateButton
{
[timeInField setText:currentTime];
}
Any help?
I am beating my head against the wall looking at the code for the last week.
The code I have is currently:
-(void) createDatePicker
{
[myDatePicker = [UIDatePicker alloc] awakeFromNib];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateStyle:NSDateFormatterNoStyle];
[dateFormatter setTimeStyle:NSDateFormatterShortStyle];
NSString* currentTime = [dateFormatter stringFromDate:[NSDate date]];
[dateFormatter release];
}
In my head the 7th line's "currentTime" should hold the date now in a string. However, in another method when I try to set the text of the UITextField to currentTime, nothing happens.
- (IBAction) buttonPress: calculateButton
{
[timeInField setText:currentTime];
}
Any help?