2

When a user picks a photo from an iPhone's camera roll, I can access the photo's date and time information.

How can I get the date information from an arbitrary UIImage or a picture in Cocoa Touch?

cellcortex
  • 3,166
  • 1
  • 24
  • 34
acwind
  • 93
  • 1
  • 4

2 Answers2

1

In iOS 4 you can use the UIImagePickerControllerMediaMetadata to fetch the data. There's some Example Code by Apple. The answers to this question might help as well.

Community
  • 1
  • 1
cellcortex
  • 3,166
  • 1
  • 24
  • 34
0

Its Working fine:

-(void)dateInfo
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSFileManager *manager = [NSFileManager defaultManager];
    NSArray *fileList = [manager contentsOfDirectoryAtPath:documentsDirectory error:nil];

    //--- Listing file by name sort
    NSLog(@"\n File list %@",fileList);




    int num;
    //-- Listing file name with modified dated
    for (NSString *s in fileList)
    {
        NSString *filestring = [documentsDirectory stringByAppendingFormat:@"/%@",s];

        NSDictionary *filePathsArray1 = [[NSFileManager defaultManager] attributesOfItemAtPath:filestring error:nil];
        NSString *modifiedDate = [filePathsArray1 objectForKey:NSFileModificationDate];
        NSLog(@"\n Modified Day : %@", modifiedDate);

        num=num+1;
    }
}
Rajesh Loganathan
  • 11,129
  • 4
  • 78
  • 90