Chapter 10 UIImagePickerController

1. Setting the image picker’s sourceType:

The sourceType constant that tells the image picker where to get images. It has three possible values:

UIImagePickerControllerSourceTYpeCamera

The user will take a new picture. This source type will not work on a device that does not have a camera. So, before using this type, you have to check for a camera by sending the message isSourceTypeAvailable: to the UIImagePickerController class.

UIImagePickerControllerSourceTypePhotoLibrary

The user will be prompted to select an album and then a photo from that album.

UIImagePickerControllerSourceTypeSavedPhotosAlbum

The user picks from the most recently taken photos.

2. To present a view controller modally, you send presentViewController:animated:completion: to the UIViewController whose view is on the screen.

3. Adding the ability to record video or choose a video from the disk is as simple as adding the constant string kUTTypeMovie to the mediaTypes array. However, not all devices support video through the UIImagePickerController. Just like the class method isSourceTypeAvailable: allows you to determine if the device has a camera, the availableMediaTypesForSourceType: method checks to see if that camera can capture video. To set up an image picker controller that can record video or take still images, you would write the following code:

UIImagePickerController *ipc = [[UIImagePickerController alloc] init];

NSArray *availableTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];

ipc.mediaTypes = availableTypes;

ipc.sourceType = UIImagePickerControllerSourceTypeCamera

ipc.delegate = self;

时间: 2024-10-09 06:54:59

Chapter 10 UIImagePickerController的相关文章

零元学Expression Blend 4 - Chapter 10 用实例了解布局容器系列-「StackPanel」

原文:零元学Expression Blend 4 - Chapter 10 用实例了解布局容器系列-「StackPanel」 本系列将教大家以实做案例认识Blend 4 的布局容器,此章介绍的布局容器是Blend 4 里的乖宝宝-「StackPanel」:及加码赠送「ScrollViewer」的运用. 本系列将教大家以实做案例认识Blend 4 的布局容器,此章介绍的布局容器是Blend 4 里的乖宝宝-「StackPanel」:及加码赠送「ScrollViewer」的运用. 就是要让不会的新手

Python Chapter 10: 列表 Part3

10.10 查找列表 )线性查找 线性查找顺序地将关键字key与列表中的每一个元素进行比较,直到找到某个匹配元素时返回其下标,亦或在找不到时返回-1.代码如下: # The function for finding a key in a list def linearSearch(lst, key): for i in range(len(lst)): if lst[i] == key: return i return -1 若关键字存在,线性查找在找到关键字前平均需要查找一半的元素,其运行时间

Cpp Chapter 10: Objects and Classes Part2

10.2.4 Using classes Following exapmle uses the class definition and implementation written in previous files: // usestok0.cpp -- the client program // compiler with stock00.cpp #include <iostream> #include "stock00.h" int main() { Stock s

Thinking in Java from Chapter 10

From Thinking in Java 4th Edition 内部类 public class Parcel1 { class Contents { private int i = 11; public int value { return i;} } class Destination { private String label; Destination(String whereTo) { label = whereTo; } String readLabel() { return l

C++ chapter 10——模板

**模板的概念 函数模板 类模板 名空间** 一.模板的概念 C++的模板提供对逻辑结构相同的数据对象通用行为的定义.模板运算对象的类型不是实际的数据类型,而是一种参数化的类型. 一个带类型参数的函数称为函数模板,一个带类型参数的类称为类模板. 二.函数模板 1.函数模板的概念 函数模板的基本原理是通过数据类型的参数化,将一组算法相同但所处理数据类型不同的重载函数凝练成一个函数模板.编译时,再由编译器按照函数模板自动生成针对不同数据类型的重载函数定义代码. 使用函数模板.对于函数模板,数据类型本

BDA chapter 10

numerical integration, 数值积分.numerical integration refers to methods in which the integral over continuous function is evaluated by computing the value of the function at finite number of points. Numerical integration methods can be divided to simulat

Head first java chapter 10 数字与静态

注意,先输出静态定义,然后运行main,输出"in main",然后statictests继承自staticsuper,所以先实现staticsuper,然后再实现statictests.

Chapter 10 Networking/JSON Services

<1>JSON Service In the previous section, you learned how to consume XML web services by using HTTP to connect to the web server and then obtain the results in XML. You also learned how to use DOM to parse the result of the XML document. However, man

数据库 chapter 10 数据库恢复技术

第十章 数据库恢复技术 介绍事务的基本概念和事务的性质,讲解数据库系统遇到故障后进行恢复技术和方法. 事务是一系列的数据库操作,是数据库应用程序的基本逻辑单元,是一个不可分割的工作单位. 事务和程序是两个概念,一般来说,一个程序里面包含多个事务. 事务处理技术主要包括数据库恢复技术和并发控制技术. 事务具有四个特性:原子性(Atomicity).一致性(Consistency).隔离性(Isolation)和持续性(Durability),这四个特性简称为ACID特性. 原子性:事务时数据库的逻