allow UIImagePickerViewController to add from library and camera - iphone

Is there an interface for allowing user tap once and be able to pick an image from the library OR the camera at the same time? I know there is way to have two buttons. I want to limit it to one button and not use an actionsheet and allow the user to switch between library and the camera while they are in the imagepicker UI. So, is there a way to set this both value? Thanks.
UIImagePickerControllerSourceTypeCamera
UIImagePickerControllerSourceTypePhotoLibrary

Related

iPhone camera toolbar buttons

The iPhone camera toolbar holds the following buttons: cancel/record
I would like to change the cancel button to the small image button that takes me to the photo library.
I wasn't sure if i need to use the overlay or does the xcode have something more comfortable in this case since this is something well known and used.
Is there something like this?
Thanks,
You can set overlayView to your UIImagePickerController
imagePicker.cameraOverlayView = yourOverlayView;
UIImagePickerController Class Reference
You can customize an image picker controller to manage user interactions yourself. To do this, provide an overlay view containing the controls you want to display, and use the methods described in “Capturing Still Images or Movies.” You can display your custom overlay view in addition to, or instead of, the default controls. Custom overlay views for the UIImagePickerController class are available in iOS 3.1 and later by way of the cameraOverlayView property. For a code example, see the PhotoPicker sample code project.

UIImagePickerController both camera and library

I would have though that the UIImagePickerController would allow you to use the camera or choose from the library from within the view? It seems I have to pick one or the other cia the sourceType? Is there no way to add a button to the choose library view to switch to camera?
You would have to implement this yourself. You can make a simple UISegmentedControl and when the value is changed, you change the source of the UIImagePickerController.

Custom button instead of the default button on the camera iphone 4

I know you must do to take a picture with a button that was created by me and not the default one.
Also as you can remove the preview that comes after taking a photo?
Can you help?
Use the showCameraControls property of UIImagePickerController to show or hide the default controls
Use the cameraOverlayView property of UIImagePickerController to provide your own view to display atop of the camera view. You can then assign this property a custom UIView that will contain your own UIButtons
Use the takePicture action/method of UIImagePickerController to ask the camera picker to take a picture. You will typically call this method in the action of your custom button.
Read the documentation and the Programming Guides ;)

How to go about playing audio files from a map-based iPhone app?

I'm currently building a cultural heritage audio tour for iPhone and would like to be able to position markers on a map so that when a user is in a particular location they can click on a hotspot and listen to audio playback relating to where they are. The audio files will be part of the app download so will not be streamed.
I am a complete beginner with iOS and have a long way to go on this project but thought best to ask some people in the know for some pointers before going in completely the wrong direction. What would be the best way to achieve audio playback from the mapView?
Providing audio playback and using the map view together should not be a problem. Though your app won't be doing audio playback "from the mapView". It will be using both an MKMapView control and issuing audio api calls as the user interacts with the map.
You can add the hotspots as map annotations using the MKPointAnnotation class or your own custom class that implements the MKAnnotation protocol.
Your app can detect when an annotation is tapped in the map view delegate method didSelectAnnotationView (see MKMapViewDelegate) or, probably better, add a disclosure button on the annotation's callout view and detect the tap of that button using the calloutAccessoryControlTapped delegate method.
So for example: app adds pins (or custom images) for each hotspot, user taps on pin, callout bubble pops up with hotspot name and a disclosure button (blue circle with arrow), user taps on button, map calls delegate method.
In those map view delegate methods, you can tell what annotation was selected using view.annotation and then based on the annotation's title or some custom property, play the matching audio.
For simple audio playback, you can use the AVAudioPlayer class.

UiimagePIckerController Interface with both camera and video

How can we display the UiImagepicker controller interface with both camera and video mode, as it is in the default camera application on iPhone.
UIImagePickerController has a mediaTypes property, which is an array of types you want to support (image, video, or both):
http://developer.apple.com/library/ios/documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html#//apple_ref/occ/instp/UIImagePickerController/mediaTypes
The way it has it within the OS is that it changes the picker via a slider in the bottom toolbar.
When the value changes from photo to video via the slider, you could recreate the UIImagePickerController with the appropriate mediaType and reload the view.
I do not know if this would be as seemless as the iPhone included way of doing things without testing it, however, this would allow you to change the picker being used from one to the other.