Thursday, May 9, 2013

NSDictionary NSFileExtensionHidden example ios


fileExtensionHidden - NSFileExtensionHidden

Returns the value for the NSFileExtensionHidden key.
- (BOOL)fileExtensionHidden
Return Value
The value for the NSFileExtensionHidden key, or NO if the dictionary doesn’t have an entry for the key.
Example of [NSDictionary NSFileExtensionHidden]
NSString *path = …;
NSDictionary *attributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:NSFileExtensionHidden];
NSError *error = nil;
[[NSFileManager defaultManager] setAttributes:attributes ofItemAtPath:path error:&error];
Example of [NSDictionary NSFileExtensionHidden]
NSString *mystring = [[NSString alloc] initWithCString:filename encoding:NSUTF8StringEncoding];

NSDictionary *attributes = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
                                                               forKey:NSFileExtensionHidden];

NSFileManager *fm = [NSFileManager defaultManager];

BOOL result = [fm setAttributes:attributes ofItemAtPath:mystring error:nil];