I\'m writing an iPhone app with Cocoa in xcode. I can\'t find any tutorials or sample code that shows how to take photos with the built in camera. How do I do this? Where can
Use UIImagePickerController
. There is a good tutorial on this here.
http://www.zimbio.com/iPhone/articles/1109/Picking+Images+iPhone+SDK+UIImagePickerController
You should set the source type to UIImagePickerControllerSourceTypeCamera
or UIImagePickerControllerSourceTypePhotoLibrary
. Note that these two types result in very different displays on the screen. You should test both carefully. In particular, if you are nesting the UIImagePickerController
inside a UINavigationController
, you can end up with multiple navigation bars and other weird effects if you are not careful.
See also this thread