gpt4 book ai didi

android - Sencha Touch 2 - 选择一张照片

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

我是 Sencha 的新手,正在尝试构建一个简单的流程,用户需要选择一张照片才能继续“第 2 步”。照片的选择可以来自新的相机捕获或来自现有照片。

这是我拍摄照片的代码:

    Ext.device.Camera.capture({
success: function(image) {
Ext.create('myapp.view.PreviewImage', {
title: 'Test photo',
description: 'Testing a camera capture',
src: image,
fullscreen: true
});
},
quality: 75,
width: 200,
height: 200,
destination: 'data'
});

我正在等待我的 iPhone 收到邮件,这样我就可以测试相机(因为 iOS 模拟器没有硬件支持)所以上面的代码可能会也可能不会。我的问题是,有什么选择 - 我从 Sencha Touch 2 文档中的示例中获取了 Ext.device.Camera 的上述代码,我看到他们将它存储在 data。我注意到在其他一些示例中,data 将是 app 的同级文件夹。

当前的 Sencha Touch 2 设备 api 是否可以浏览设备上的照片?我在 Sencha 论坛上阅读了一些关于使用 PhoneGap 作为 native 设备包装器的帖子,但是对于 Sencha Touch 2,它有自己的 native 包装器和设备 API,所以我认为我应该能够在这里包含整个应用程序。

根据他们位于此处的文档(似乎不完整):http://docs.sencha.com/touch/2-0/#!/api/Ext.device.Camera

Both the Sencha Packager and PhoneGap implementations will use the native camera functionality to take or select a photo. The Simulator implementation will simply return fake images.

Ext.device.Camera 的文档中提到的仅有的两个方法是 capture()getInitialConfig()

谁能给我指出一个 fragment 或提供一个简单的例子来浏览设备上的现有照片?

更新 - 根据答案中引用的新文档,这里是 source 属性规范:

The source of where the image should be taken. Available options are:

album - prompts the user to choose an image from an album
camera - prompts the user to take a new photo
library - prompts the user to choose an image from the library

最佳答案

您可以设置捕获方法的source属性。

文档:http://docs.sencha.com/touch/2-0/#!/api/Ext.device.camera.Abstract-method-capture

Ext.device.Camera.capture({
source: 'library',
...
});

关于android - Sencha Touch 2 - 选择一张照片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10525040/

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