Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This will take you to the image gallery and you can select the image. </p> <pre><code>UIImagePickerController *imagePickerController = [[UIImagePickerController alloc]init]; imagePickerController.delegate = self; imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [self presentViewController:imagePickerController animated:YES completion:nil]; </code></pre> <p>this will help you select the image </p> <pre><code>- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo { // Dismiss the image selection, hide the picker and //show the image view with the picked image [picker dismissViewControllerAnimated:YES completion:nil]; //UIImage *newImage = image; } </code></pre> <p>And then you can store this image to the documents directory...</p> <pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *savedImagePath = [documentsDirectory stringByAppendingPathComponent:@"savedImage.png"]; UIImage *image = imageView.image; // imageView is my image from camera NSData *imageData = UIImagePNGRepresentation(image); [imageData writeToFile:savedImagePath atomically:NO]; </code></pre> <p>For clicking the image yourself use this</p> <pre><code>- (IBAction) takePhoto:(id) sender { UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.delegate = self; imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera; [self presentModalViewController:imagePickerController animated:YES]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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