gpt4 book ai didi

ios - 在相机 View 上显示自定义按钮

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:33:04 27 4
gpt4 key购买 nike

有谁知道是否有办法在相机 View 上粘贴自定义按钮,以允许用户像 oink 或 instagram 一样从他们的图库中选择照片,而无需制作自定义 View ?谢谢!

编辑

使用叠加层添加按钮似乎很容易;有谁知道如何从那里实际显示照片库并使用该人选择的内容?

最佳答案

来自 UIImagePickerController 的文档:

You can customize an image picker controller to manage user interactions yourself. To do this, provide an overlay view containing the controls you want to display, and use the methods described in “Capturing Still Images or Movies.” You can display your custom overlay view in addition to, or instead of, the default controls. Custom overlay views for the UIImagePickerController class are available in iOS 3.1 and later by way of the cameraOverlayView property. For a code example, see the PhotoPicker sample code project.

https://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html

您为照片库按钮选择的委托(delegate)也应该有权访问 UIImagePickerController。然后,当为相册按下按钮时,您可以在 UIImagePickerController 上调用 presentModalViewController:animated:(或 presentViewController:animated:completion: 如果您的目标是 iOS 5 及更高版本),传入一个新的 UIImagePickerController,并将 sourceType 设置为 UIImagePickerControllerSourceTypePhotoLibrary。

我用其他两种方式处理了这个问题:第一种,在显示图像选择器之前使用 UIActionSheet 提示用户;第二,将选择器托管在选项卡 Controller 或其他容器 Controller 中。

关于ios - 在相机 View 上显示自定义按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9220872/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com