iOS中获取当前时间
UITextField *textField = [[UITextFieldalloc] initWithFrame:CGRectMake(10,350, 300, 40)];
textField.borderStyle =UITextBorderStyleRoundedRect;
textField.backgroundColor = [UIColorcyanColor];
textField.placeholder =@"时间";
[self.windowaddSubview:textField];
NSDate * timeDate=[NSDatedate];
NSDateFormatter *dateformatter=[[NSDateFormatteralloc] init];
[dateformattersetDateFormat:@"HH:mm:ss"];
[dateformattersetDateFormat:@"HH-mm-ss"];
NSString * locationString=[dateformatter stringFromDate:timeDate];
textField.text = locationString;