문제

I just started saving sceenshots of my current application. Instead of giving the screenshots names beforehand I'd like to use the current date+ time (something unique) as the filename. I found a method timeIntervalSince1970 in objective C but it doesn't seem to exist in C4. So is there some other function that would return the current date?

도움이 되었습니까?

해결책

timeIntervalSince1970 is a class method of NSDate. If you want to get the current time every screenshot you can use as a unique identifier you can do something like this.

NSString * s = [NSString stringWithFormat:@"awesomeshot%@.jpg", [NSDate date]];
C4Log(@"%@",s );

If you really want to use timeIntervalSince1970 you can check out this discussion: How to convert NSDate into unix timestamp iphone sdk?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top