iOS编程。如何通过手机获取电话簿应用程序的图片

时间:2014-08-23 13:31:12

标签: ios

我需要你的帮助/参考/提示如何从iPhone 1和2)从iPhone前置摄像头获取图片。因此我的程序将此图片复制到iPhone上的本地文件夹(而不仅仅是引用图库)。感谢

1 个答案:

答案 0 :(得分:1)

您可能会发现this appple developer doc上的信息很有用。您可以使用UIImagePickerController从上面的doc中显示模式视图,如下面的代码所示。

- (BOOL) startMediaBrowserFromViewController: (UIViewController*) controller
           usingDelegate: (id <UIImagePickerControllerDelegate,
                               UINavigationControllerDelegate>) delegate {

if (([UIImagePickerController isSourceTypeAvailable:
             UIImagePickerControllerSourceTypeSavedPhotosAlbum] == NO)
        || (delegate == nil)
        || (controller == nil))
    return NO;

UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
mediaUI.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;

// Displays saved pictures and movies, if both are available, from the
// Camera Roll album.
mediaUI.mediaTypes =
    [UIImagePickerController availableMediaTypesForSourceType:
        UIImagePickerControllerSourceTypeSavedPhotosAlbum];

// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
mediaUI.allowsEditing = NO;

mediaUI.delegate = delegate;

[controller presentModalViewController: mediaUI animated: YES];
return YES;                          
}

我建议你仔细阅读上面的文档,因为它内容非常丰富,但不容易解读。

希望这有帮助!