问题描述
有没有人知道如果有一个方法来贴在相机视图上的自定义按钮,以允许用户从他们的库中选择一张照片,如oink或instagram没有做一个自定义视图?非常感谢!
Does anyone know if there's a way to stick a custom button on the camera view to allow a user to select a photo from their library like oink or instagram does without making a custom view? Thanks!
编辑
有谁知道如何实际显示照片库从那里,并使用人选择什么?
Adding the button seems easy with the overlay; does anyone know how to actually display the photo library from there and use what the person selects?
推荐答案
从UIImagePickerController的文档:
From the documentation for UIImagePickerController:
您为照片库按钮选择的代理也应该可以访问UIImagePickerController。然后,当按下相册的按钮时,您可以在UIImagePickerController上调用presentModalViewController:animated:(或presentViewController:animated:completion:如果您要定位iOS 5及以上版本),传入一个新的UIImagePickerController,将sourceType设置为UIImagePickerControllerSourceTypePhotoLibrary。
The delegate you choose for your photo library button should also have access to the UIImagePickerController. Then, when the button is pressed for photo album, you can call presentModalViewController:animated: (or presentViewController:animated:completion: if you are targeting iOS 5 and up) on the UIImagePickerController, passing in a new UIImagePickerController with sourceType set to UIImagePickerControllerSourceTypePhotoLibrary.
我已经通过两种方式处理了这个问题:第一,只是使用UIActionSheet在显示图像选择器之前提示用户;第二,在选项卡控制器或其他容器控制器中托管选择器。
I've handled this issue in two other ways: 1st, just use a UIActionSheet to prompt the user prior to showing the image picker; 2nd, host the pickers in a tab controller or other container controller.
这篇关于在相机视图上显示自定义按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!