我一直在使用iOS 12以上版本的'UIKit.UIUserInterfaceStyle UIKit.UITraitCollection :: get_UserInterfaceStyle()'API。我需要在iOS版本9+上编译源代码,我需要使用条件编译来区分上述API的用法。有没有可能完成它?
答案 0 :(得分:0)
您可以在运行时检查设备版本,然后选择是否使用APi:
if (UIDevice.CurrentDevice.CheckSystemVersion(12, 0))
{
//use api in iOS 12
}
else
{
//...
}