2011-04-26 55 views

回答

20

怎麼樣NSFileManagersetAttributes:ofItemAtPath:error:方法?

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html

屬性是一本字典。您可以使用NSFileModificationDate鍵來設置修改日期值。

基本上:

NSDictionary* attr = [NSDictionary dictionaryWithObjectsAndKeys: yourDate, NSFileModificationDate, NULL]; 

[[NSFileManager defaultManager] setAttributes: attr ofItemAtPath: yourPath error: NULL];