Note that there are some explanatory texts on larger screens.

plurals
  1. POXCode - Display/delete files from NSDocumentDirectory
    primarykey
    data
    text
    <p>My application has a 'Browse' button with these codes that allows user to browse the iPad's photo gallery, select a photo and store it into the application using NSDocumentDirectory.</p> <pre><code>- (IBAction) BrowsePhoto:(id)sender { UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController]; [popover setPopoverContentSize:CGSizeMake(320,320)]; [popover presentPopoverFromRect:CGRectMake(200,200,-100,-100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; self.popoverController = popover; [imagePickerController release]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)selectedImage editingInfo:(NSDictionary *)editingInfo { [self.popoverController dismissPopoverAnimated:YES]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [paths objectAtIndex:0]; NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:@"SavedImage.png"]; UIImage *image = imageView.image; NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:NO]; } </code></pre> <p>Now i want to include a 'Display' button which displays all the photos from the NSDocumentDirectory in a new view. Was thinking of displaying it in thumbnails and also when an image is tapped, it will have a pop up asking the user to confirm if he/she wants to delete the selected photo. If yes, the photo will be removed from the NSDocumentDirectory.</p> <p>Is it possible to do this? If it is, mind telling me how to do it and share some sample codes? I'm quite lost as i'm still quite new to programming.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload