- - (NSString*)getDate
- {
- NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
- [formatter setDateStyle:NSDateFormatterMediumStyle];
- [formatter setTimeStyle:NSDateFormatterShortStyle];
- [formatter setDateFormat:@"YY/MM/dd HH:mm"];
- NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Shanghai"];
- [formatter setTimeZone:timeZone];
- NSDate *datenow = [NSDate date];
- return [formatter stringFromDate:datenow];
- }
碰触背景键盘消失
- - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
- UITouch *touch = [touches anyObject];
- UIView *view = (UIView *)[touch view];
- if (view == _bkImageView || view == _imageView)
- {
- [_upTv resignFirstResponder];
- [_downTv resignFirstResponder];
- }
- }
本文介绍了一个Objective-C方法,用于获取当前日期并将其格式化为特定的字符串格式,同时展示了一段代码来实现当触摸背景时隐藏软键盘的功能。

被折叠的 条评论
为什么被折叠?



