Home > Software design >  Cross compatible differences xamarin / C#
Cross compatible differences xamarin / C#

Time:10-11

hope you can help!

Wondering how I can change code based on device version?

For example I have skia sharp code with a size integer set as below:

int size = Math.Min(180, 180);

On ios 13 this looks good but on ios 11 it's way too big!

How can I change the code behind size integer based on the ios version?

Thanks!

CodePudding user response:

You can get the iOS version and based on it you can set the value accordingly.

string version = UIDevice.CurrentDevice.SystemVersion;

if(version == ……….

CodePudding user response:

Just simply use UIDevice.CurrentDevice.CheckSystemVersion(13,0) .

It equals to @available(iOS 13, *) in Objective-C .

Refer to

https://stackoverflow.com/a/21263587/8187800.

  • Related