Sunday, 11 August 2013

Selecting Where to Save Photo to Directory using PickerView

Selecting Where to Save Photo to Directory using PickerView

I want to save a photo that the user has taken which is displayed in the
UIImage. I also added a pickerview that is like follows
- (NSInteger)pickerView:(UIPickerView *)thePickerView
numberOfRowsInComponent:(NSInteger)component {
if (component == genre)
return [arraygenre count];
return 0;
}
- (NSString *)pickerView:(UIPickerView *)thePickerView
titleForRow:(NSInteger)row forComponent:(NSInteger)component {
if (component == genre)
return [arraygenre objectAtIndex:row];
return 0;
}
I also have created a directory using the code
NSArray *directoryNames = [NSArray arrayWithObjects:@"t",@"b",@"p",@"c",
@"S", @"", @"o",nil];
NSArray *paths =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0]; // Get
documents folder
for (int i = 0; i < [directoryNames count] ; i++) {
NSString *dataPath = [documentsDirectory
stringByAppendingPathComponent:[directoryNames objectAtIndex:i]];
if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath
withIntermediateDirectories:NO attributes:nil error:nil];
I want to make the user select which genre he wants to save to and then
when the user presses the save button the photo is saved. Is it possible
to do this?and How am I suppose to achieve what I want to do? I am doing
this for nearly 2 weeks and I did not have success. It will be helpful if
you explain me how to do it. Thank you.

No comments:

Post a Comment