How would you go about allowing the user to input an image in an Xcode app on iPhone?
For example setting a profile picture, where the actual user chooses the image from their photo library (or take picture etc.)
To pick a photo, you'll need a PHPickerViewController.
This documentation page should help to understand how to use it: Selecting Photos and Videos in iOS.
The easiest way to take a picture is to present a UIImagePickerController with the sourceType of .camera.
Related
I have an app where the user can create an account and take a picture of himself to use as an avatar. I'm obviously using Camera module for that. Now I would like to add an option for user to choose an existing picture from the device gallery, but I've been unable to find such functionality neither in build-in Camera module or any 3-rd party plugin. I'm looking something similar to Cordova camera plugin: https://github.com/apache/cordova-plugin-camera, where one can specify PictureSourceType and on getPicture the app will show the gallery and the user can choose a picture from there, then callback will return base64-encoded string or URI for the image file. Thanks ahead for any insights!
Yes use this plugin https://github.com/NativeScript/nativescript-imagepicker
To select from the device.
Is it possible to hide pictures taken by the camera or by choosing a file (I am creating a copy of it)?
Or do I have to change the file-extension of the picture, or will it then be rejected by Apple?
I am using XLabs for taking/selecting the picture
If you save it locally as an app data file then it shouldn't be then showed in the gallery.
So, to reiterate: Save the file as an app data-file.
I have found Apple's example app ImagePicker that uses IKImagePicker, but it appears that in Lion it has been removed. Is there an alternative to this - or how would I prompt users to select an image to use within my app.
You want IKPictureTaker.
The IKPictureTaker class represents a panel that allows users to choose images by browsing the file system. The picture taker panel provides an Open Recent menu, supports image cropping, and supports taking snapshots from an iSight or other digital camera.
In my wp7 app, I am able to save pictures taken from a camera in the saved pictures album and able to read them later. If a particular record is deleted in the app, I want to delete the associated picture with that entity from the saved pictures album.
Has anyone tried this? I don't seem to find any methods on the media library to perform this?
Pratik
There's no API for removing the user's pictures from their device.
The phone's owner is in exclusive control of this function.
An alternative approach may work for you to keep pictures in isolated storage and offer the user the ability to optionally put them in their media library, passing control of that capability to the phone's owner as well.
Is it possible to write an app to behave like the photo picker does in the Photos app? Namely allowing users to select multiple images and greying out or putting a green tick on the selected ones?
I've tried UIImagePickerController, but that appears to just dim the image when it's touched.
If you’re working with iOS 4 then yes you can (but we’re bound by the oh-so-silly NDA for now), with a custom interface. Else maybe you’d like to look into Three20, it has an image picker which intend to mimic the original and works very well with custom photos (that is, not those in the camera roll or accessible with the Photos app). Maybe you could fork it and add custom behavior.