没有合适的资源?快使用搜索试试~ 我知道了~
斯坦福大学开放课程:iOS开发教程2010年秋(Lecture 17)
需积分: 0 1 下载量 169 浏览量
2012-11-14
17:02:15
上传
评论
收藏 4.48MB PDF 举报
温馨提示
试读
18页
斯坦福大学开放课程:iOS开发教程2010年秋(Lecture 17)
资源推荐
资源详情
资源评论
Stanford CS193p
Developing Applications for iPhone 4, iPod Touch, & iPad
Fall 2010
Stanford
CS193p
Fall 2010
To day: Me dia
UIImagePickerController
Getting still photos or video from the user (either from camera or photo library)
MPMovie[View]PlayerController
How to play videos
ALAssetsLibrary
How to store images or videos in the user’s photo album
Sounds
How to play simple sounds and record simple audio snippets
Stanford
CS193p
Fall 2010
UIImagePickerController
Modal view to get media from camera or photo library
Modal means you put it up with presentModalViewController:animated:
Usage
Create it with alloc/init and set delegate.
Configure it (source, kind of media, user editability).
Present it modally.
Respond to delegate method when user is done picking the media.
What the user can do depends on the platform
Some devices have cameras, some do not, some can record video, some can not.
As with all device-dependent API, we want to start by check what’s available.
+ (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType;
UIImagePickerControllerSourceTypePhotoLibrary
Camera
SavedPhotosAlbum
Stanford
CS193p
Fall 2010
UIImagePickerController
But don’t forget that not every source type can give video
So, you then want to check ...
+ (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType;
Returns an array of strings you check against constants.
Check documentation for all possible, but there are two key ones ...
kUTTypeImage // pretty much all sources provide this
kUTTypeMovie // audio and video together, only some sources provide this
You can get even more specific about front/rear cameras
(Though usually this is not necessary.)
+ (BOOL)isCameraDeviceAvailable:(UIImagePickerControllerCameraDevice)cameraDevice;
Either UIImagePickerControllerCameraDeviceFront or UIImagePickerControllerCameraDeviceRear.
Then check out more about each available camera:
+ (BOOL)isFlashAvailableForCameraDevice:(UIImagePickerControllerCameraDevice);
+ (NSArray *)availableCaptureModesForCameraDevice:(UIImagePickerControllerCameraDevice);
This array contains NSNumber objects with constants UIImagePic...lerCaptureModePhoto/Video.
Stanford
CS193p
Fall 2010
剩余17页未读,继续阅读
资源评论
lb33896986
- 粉丝: 25
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功