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

发布于 2024-08-01 19:56:01 字数 222 浏览 5 评论 0原文

我正在编写一个使用 UIImagePickerController 的应用程序。 我想让用户选择图片来源,要么拍摄新照片,要么从现有照片中进行选择。 当您按住链接时,我想创建与 twitterfon 或 safari 中完全相同的选择界面。 它看起来像一些标准的 SDK 东西,但我完全不知道在哪里可以找到一些示例代码。 我用谷歌搜索了几个小时,但一无所获。

我真的很感激任何提示。 谢谢

I'm writing an application that uses 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. It looks like some standard SDK thing but I have completely no clue where to find some sample code. I've googled for hours and I have nothing.

I would really appreciate any tips.
Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

物价感观 2024-08-08 19:56:01

您正在寻找的是 UIActionSheet。 该文档包含设置所需的一切以及如何响应按下哪个按钮。

您还需要使用为 UIImagePickerController 源定义的常量,即

UIImagePickerControllerSourceTypeCamera
UIImagePickerControllerSourceTypePhotoLibrary

What you're looking for is the 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

UIImagePickerControllerSourceTypeCamera
UIImagePickerControllerSourceTypePhotoLibrary
花之痕靓丽 2024-08-08 19:56:01

这将是一个 UIActionSheet。 确保将其委托属性指向 UIActionSheetDelegate 协议来捕获您定义的按钮上的点击。

That would be an UIActionSheet. Make sure to point its delegate property to your implementation of the UIActionSheetDelegate protocol to catch clicks on the buttons you define.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文