在选项卡式 UIPopover 中使用 UIImagePicker
我正在开发一个 iPad 应用程序,需要在设备/相册、远程和应用程序中包含多个图像源。现在理想的情况是拥有一个 UIPopover 控制器,每个源有 3 个选项卡。唯一的问题是我似乎无法弄清楚如何让 UIImagePicker 位于其自己的选项卡中。我想做的事情与 Apple iPad 上的 Keynote 非常相似。照片图标的弹出窗口有选项卡,最左边的称为媒体的选项卡肯定有一个 UIImagePicker。我不知道他们是怎么做到的,我可以做这样的事情吗?我认为主要问题是图像选择器是它自己的导航控制器,不能将其推送到另一个导航控制器。任何帮助将不胜感激!
I am developing an iPad app that needs to have multiple image sources, on the device/Photo Albums, remote and some included with the app. Now the ideal situation would be to have a UIPopover controller with 3 tabs for each source. The only problem is I can't seem to figure out how to have a UIImagePicker be in its own tab. What I am trying to do is very similar to Apple's Keynote for iPad. The photo icon's popover has tabs and the far left tab called media for sure has a UIImagePicker in there. I have no idea how they did that, is it possible for me to do something like that? I think the main issue is that the Image Picker is it's own navigation controller and it cannot be pushed on to another navigation controller. Any help would be greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看看这个 - https://github.com/key1jp/ELCImagePickerController
你可以使用自定义资源库来实现它
check out this - https://github.com/key1jp/ELCImagePickerController
you can implement it with custom asset library
内置的图像选择器不好。
创建您自己的图像选择器并将其作为普通视图添加到导航控制器中。从 WWDC 2010 示例中的 Matt Tuzzolo 或 MyImagePicker 开始代码。请注意,您可能想要添加图像和视频预览 - 我从 MyImagePicker 复制了图像查看器,并向其添加了“添加”或“删除”按钮,视频也是如此。
您的图像选择分为两个步骤,第一步是选择组,第二步是选择组内的资产。我建议将第一步分成两部分 - 如果只有一个,则直接进入该组,即当您找到第一个组时,检查该组是否是最后一个(块停止参数)。然后按下右视图控制器。
显然也修改了缩略图的大小,它们现在是 iPhone 大小。添加一行元数据(图标和持续时间)看起来更好,并且对于视频来说信息更丰富。
我还建议添加“点击并按住”功能,以在 2 秒后获取更多信息。
通过创建一个为您提供所需内容的协议来处理不同的源,即
创建一个处理本地文件、包含的资源和资产的源是完全可能的 - 我使用 NSURL 并检查 url 方案。
The built-in image picker is no good.
Create your own image picker and add it to your navigation controller as a normal view. Start from either the Matt Tuzzolo or the MyImagePicker from the WWDC 2010 sample code. Note that you probably want to add image and video preview - I copied the image viewer from MyImagePicker and added a 'add' or 'remove' button to it, and the same for video.
Your image picking is in two steps, one for selecting the group, and one for selecting the assets within the group. I recommend dividing the first step into a two - if there is only one, then go directly to that group, i.e. when you have found the first group, check whether that group was the last (block stop argument). Then push the right view controller.
Obiously modify the size of the thumbnails also, they are iPhone size now. Adding a line of metadata (icon and duration) looks much nicer and is more informative for video.
I also recommend adding a 'click-and-hold' function for extended information after like 2 seconds.
Handle different sources by creating a protocol which gives you what you want, i.e.
Creating a source which handles local files, included resources and assets is perfectly possible - I use NSURLs and check on the url scheme.
您的选项卡不使用 UITabBarController 吗?您应该能够将 UIImagePickerController 直接添加到 viewControllers 中。不过,我不确定图像选择器是否支持这种用法; 文档仅提到显示它以模态方式或在 UIPopoverController 中显示它。
通过查看 Apple 应用程序来了解您可以使用各种内置控件做什么通常没有什么用处,因为 Apple 允许自己使用私有 API。
Are you not using UITabBarController for your tabs? You should be able to add a UIImagePickerController directly to
viewControllers
. I'm not sure whether that is a supported use of the image picker, though; the documentation only mentions displaying it modally or displaying it in a UIPopoverController.It's not usually useful to look at an Apple app to find out what you can do with various built-in controls, as Apple allows themselves to use private APIs.