How can I take a photo with my iPhone app?

前端 未结 5 1448
甜味超标
甜味超标 2021-01-31 19:39

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

5条回答
  •  时光取名叫无心
    2021-01-31 20:18

    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

提交回复
热议问题