//UIView 转换为图片
UIGraphicsBeginImageContext(self.rootsView.bounds.size);
[_rootsView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewBeImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewBeImage;
//本地时间
NSDate *now = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:now];
NSInteger year = [dateComponent year];//年
NSInteger month = [dateComponent month];//月
NSInteger day = [dateComponent day];//日
NSInteger hour = [dateComponent hour];//小时
NSInteger minute = [dateComponent minute];//分钟
NSInteger second = [dateComponent second];//秒钟
NSLog(@"year is: %ld", year);
NSLog(@"month is: %ld", month);
NSLog(@"day is: %ld", day);
NSLog(@"hour is: %ld", hour);
NSLog(@"minute is: %ld", minute);
NSLog(@"second is: %ld", second);