Codenameone iOS上的FileChooser未打开文件(图片)
我注意到,当我使用FileChooser类来获取图像时,它在Android上工作,但在iOS上不工作。 我想这可能是因为filepath的不同工作或iOS的特殊权限 有什么想法/建议吗? 多谢各位 这是我的密码:Codenameone iOS上的FileChooser未打开文件(图片),codenameone,Codenameone,我注意到,当我使用FileChooser类来获取图像时,它在Android上工作,但在iOS上不工作。 我想这可能是因为filepath的不同工作或iOS的特殊权限 有什么想法/建议吗? 多谢各位 这是我的密码: ActionListener callback = e -> { if (e != null && e.getSource() != null) { String filePath = (String) e.getSourc
ActionListener callback = e -> {
if (e != null && e.getSource() != null) {
String filePath = (String) e.getSource();
cont.removeAll();
try {
Image originImg = Image.createImage(filePath);
Image smallImg = originImg.scaled(getWidth()/2, -1);
ScaleImageButton iv = new ScaleImageButton(smallImg);
iv.addActionListener(evt->{
Dialog previewForm = new Dialog();
previewForm.addPointerReleasedListener(i-> previewForm.dispose());
ImageViewer imagePreview = new ImageViewer();
imagePreview.addPointerReleasedListener(i-> previewForm.dispose());
imagePreview.setImage(originImg.scaled(getWidth(), -1));
previewForm.setDisposeWhenPointerOutOfBounds(true);
previewForm.add(imagePreview);
previewForm.show();
});
cont.add(iv);
revalidate();
} catch (IOException ex) {
}
}
};
if (FileChooser.isAvailable()) {
Log.p("FileChooser open");
FileChooser.showOpenDialog(".png,image/png,.jpg,image/jpg,.jpeg", callback);
} else {
Display.getInstance().openGallery(callback, Display.GALLERY_IMAGE);
}
如果您使用的是
FileChooser
cn1lib,请注意,您需要更改配置文件。见此:谢谢您的回复。iOS设置是在我创建最新的配置文件之前,根据本教程完成的。刚刚检查了所有的设置-一切似乎都是正确的。还有什么提示吗?我得查一下再给你回复。