3
私はこのオンライン(古い記事)についてたくさん見てきましたが、何も私にとってはうまくいかないようです。 文字列からQRコードを生成してアプリに表示しようとしています。ここでXamarin.FormsとZxingでQRコードを生成
は、私はAndroidのための罰金に動作しますが、IOSデバイス上のすべてでレンダリングされていない初め
qrCode = new ZXingBarcodeImageView
{
BarcodeFormat = BarcodeFormat.QR_CODE,
BarcodeOptions = new QrCodeEncodingOptions
{
Height = 50,
Width = 50
},
BarcodeValue = codeValue,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
ていたものです。 だから研究した後、私はこのようにそれを実行しようとしました:
Image qrCode;
if (Device.OS == TargetPlatform.iOS)
{
var writer = new BarcodeWriter
{
Format = BarcodeFormat.QR_CODE,
Options = new ZXing.Common.EncodingOptions
{
Width = 50,
Height = 50
}
};
var b = writer.Write(codeValue);
qrCode = new Image
{
Aspect = Aspect.AspectFill,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
Source = ImageSource.FromStream(() =>
{
MemoryStream ms = new MemoryStream(b);
ms.Position = 0;
return ms;
})
};
}else{
qrCode = new ZXingBarcodeImageView
{
BarcodeFormat = BarcodeFormat.QR_CODE,
BarcodeOptions = new QrCodeEncodingOptions
{
Height = 50,
Width = 50
},
BarcodeValue = codeValue,
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand
};
}
Content = new StackLayout
{
Children = {
header, lblExplenationText, qrCode
},
BackgroundColor = Color.White
};
しかし、すべてでレンダリングは何も残っていません。
ZXing.Mobile.Forms NuGetパッケージのバージョン:2.1.47(最新)
あなたは解決策を見つけましたか?そうでない場合、私はあなたが賞金を開始するのを手伝うことができます – knocte