简体   繁体   English

iPhone-UIImagePickerController-如何允许用户选择来源?

[英]iPhone - UIImagePickerController - How to allow user to pick the source?

I'm writing an application that uses UIImagePickerController. 我正在编写一个使用UIImagePickerController的应用程序。 I'd like to give users choice of source of pictures, either take a new photo or choose from existing ones. 我想为用户提供图片来源的选择,可以拍摄新照片或从现有照片中进行选择。 I'd like to create exactly the same selection interface as is in twitterfon or in safari when you hold tap on the link. 当您点击链接时,我想创建与twitterfon或safari中完全相同的选择界面。 It looks like some standard SDK thing but I have completely no clue where to find some sample code. 看起来像一些标准的SDK东西,但是我完全不知道在哪里可以找到一些示例代码。 I've googled for hours and I have nothing. 我已经搜索了几个小时,却一无所获。

I would really appreciate any tips. 我真的很感谢任何提示。 Thank you 谢谢

What you're looking for is the UIActionSheet. 您正在寻找的是UIActionSheet。 The documentation has everything you need to set one up and how to respond to which button is pressed. 该文档包含您需要设置的所有内容以及如何响应按下哪个按钮。

You'll also want to use the constants defined for the UIImagePickerController sources, namely 您还需要使用为UIImagePickerController源定义的常量,即

UIImagePickerControllerSourceTypeCamera
UIImagePickerControllerSourceTypePhotoLibrary

That would be an UIActionSheet . 那将是一个UIActionSheet Make sure to point its delegate property to your implementation of the UIActionSheetDelegate protocol to catch clicks on the buttons you define. 确保将其委托属性指向UIActionSheetDelegate协议的实现,以捕获对定义的按钮的单击。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用uiimagepickercontroller让用户一次选择多个图像? - How do I use the uiimagepickercontroller to let the user pick multiple images at once? 如何从ios中的UIImagePickerController中选择多个图像 - How to pick multiple images from UIImagePickerController in ios 如何使用UIImagePickerController类仅允许iPhone 3GS的录像机显示 - How to allow only the video recorder of iPhone 3GS to show up using UIImagePickerController class 我如何允许用户从其iPod库中选取歌曲? - How do i allow a user to pick a song from their iPod library? UIImagePickerController选择多个图像 - UIImagePickerController Pick Multiple images 如何使用iPhone库中的UIImagePickerController中的选择按钮 - how to work with choose button in UIImagePickerController in iPhone library iPhone SDK - 如何在UIImagePickerController中禁用图片预览? - iPhone SDK - How to disable the picture preview in UIImagePickerController? 如何在iPhone的UIImagePickerController中捕获视频的缩略图 - how to capture the thumnail of the video in UIImagePickerController in iphone 如何在iPhone中使用移动和缩放UIImagePickerController? - How to use move and scale UIImagePickerController in iPhone? iPhone:UIImagePickerController如何获取选择器控件的缩略图 - iphone: UIImagePickerController how to get the thumbnail for the picker control
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM