nativescript - 像 nativescript 插件一样实现 IRLDocumentScanner CocoaPods
问题描述
我正在寻找实现IRLDocumentScanner CocoaPods 之类的 nativescript 插件。我已经正确安装了 Pod,并测试了我是否可以从IRLScannerViewController
.
基于对象 C 的文档已尝试但保存时崩溃!myScanner.ios.ts
import { Common } from './myScanner.common';
declare var IRLScannerViewController: any
export class myScanner extends Common {
constructor() {
super()
}
public createNativeView() {
const session = new AVCaptureSession();
session.sessionPreset = AVCaptureSessionPreset1280x720;
const device = AVCaptureDevice.defaultDeviceWithMediaType(AVMediaTypeVideo);
const input = AVCaptureDeviceInput.deviceInputWithDeviceError(device);
if (!input) {
throw new Error("Error trying to open camera.");
}
session.addInput(input);
session.startRunning();
const videoLayer = AVCaptureVideoPreviewLayer.layerWithSession(session);
const camereraView = UIView.alloc().initWithFrame({ origin: { x: 0, y: 0 }, size: { width: 400, height: 600 } });
camereraView.backgroundColor = UIColor.blueColor;
videoLayer.frame = camereraView.bounds;
camereraView.layer.addSublayer(videoLayer);
this.cameraView = camereraView
return this.cameraView
}
public initNativeView() {
let delegate = IRLScannerViewControllerDelegate.prototype
const scanner = IRLScannerViewController.standardCameraViewWithDelegate(delegate)
scanner.presentViewControllerAnimatedCompletion(scanner, true, null);
}
public destroyNativeView() {
}
}
解决方案
推荐阅读
- javascript - 为什么我的 d3 数据中的第一个元素没有更新?
- ruby-on-rails-3 - 安装 aws-sdk-3 后无法启动 Rails 服务器
- angular - 如何将对象从 Angular 发送到 Asp.net Web Api?
- c# - 将此 C++ 浮点数组移植到 C#
- wix - Wix 安装程序在安装时删除了不同的产品
- asp.net-mvc - Http 错误 500 Azure 网站部署问题
- pcfdev - 由于缺少 KVM,无法在 Ubuntu 上启动 PCF Dev (cf dev start)
- python - 将文件从 S3 读入 Python 内存
- php - 如何将html标签放入php序列化数组中
- c# - Linq 模糊搜索