2016-09-08 8 views
0

私は現在Xamarinフォームを使用しています。特定のiPhoneバージョンのコードを書く必要があります。何かif (iphone == 5S) then do somethingのようなものです。XamarinフォームiPhoneデバイスの詳細

これはXamarin Studio(Forms)でどのように達成できますか?

答えて

0

thisプラグインを使用すると、デバイスモデルを取得できます。良い方法は、Debug.WriteLine()を使用してデバイスモデルを印刷し、メソッドが返すものを確認することです。

var model = CrossDeviceInfo.Current.Model; 
Debug.Write(model); 
if (model == "MySmartPhoneModel) 
{ 
    // Your method 
} 
0

これは、DependencyServiceを使用しても実現できます。 DependencyServiceを使用すると、ネイティブ機能にアクセスできます。 https://developer.xamarin.com/guides/xamarin-forms/dependency-service/

UIDevice.CurrentDevice.Modelを使用すると、iOSプロジェクトでユーザーのデバイスのモデルを取得できます。

関連する問題