相关疑难解决方法(0)

如何查看iOS版本?

我想检查iOS设备的版本是否大于3.1.3 我尝试过的东西:

[[UIDevice currentDevice].systemVersion floatValue]
Run Code Online (Sandbox Code Playgroud)

但它不起作用,我只想要一个:

if (version > 3.1.3) { }
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

objective-c ios

837
推荐指数
13
解决办法
44万
查看次数

[UIScreen mainScreen] .bounds.size在iOS8中是否依赖于方向?

我在iOS 7和iOS 8中运行了以下代码:

UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
BOOL landscape = (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight);
NSLog(@"Currently landscape: %@, width: %.2f, height: %.2f", 
      (landscape ? @"Yes" : @"No"), 
      [[UIScreen mainScreen] bounds].size.width, 
      [[UIScreen mainScreen] bounds].size.height);
Run Code Online (Sandbox Code Playgroud)

以下是iOS 8的结果:

Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 568.00, height: 320.00
Run Code Online (Sandbox Code Playgroud)

与iOS 7中的结果相比:

Currently landscape: No, width: 320.00, height: 568.00
Currently landscape: Yes, width: 320.00, height: 568.00
Run Code Online (Sandbox Code Playgroud)

是否有任何文件指定此更改?或者它是iOS 8 API中的临时错误?

orientation uiinterfaceorientation ios uiscreen ios8

184
推荐指数
8
解决办法
8万
查看次数

什么是iPhone 6和6 Plus的平台字符串?

iPhone 6和6 Plus的平台字符串是什么?

仅供参考:平台字符串非常重要,因为它有助于识别硬件模型以进行编程.

以下是我的猜测:

  • iPhone 6(GSM):iPhone7,1
  • iPhone 6(全球):iPhone7,2
  • iPhone 6 Plus(GSM):iPhone7,3
  • iPhone 6 Plus(全球):iPhone7,4

iphone ios iphone-6

31
推荐指数
4
解决办法
1万
查看次数

如何以编程方式精确地找到PPI

我试图找出iOS中的PPI(Pixils Per Inch).

我找不到任何直接的方法来查询这个,就像我们对显示大小一样

UIScreen.mainScreen().bounds
Run Code Online (Sandbox Code Playgroud)

有一种方法可以通过将尺度与iPhone(163)或iPad(132)的标准通用PPI相乘来实现,但这并不准确.

如果公式是正确的那么PPIiPhone 6 plus是489,但在现实的PPI为401这里是参考

现在似乎硬编码是要走的路.

但我想使用公式以编程方式进行.

ppi screen-resolution ios uiscreen swift

11
推荐指数
2
解决办法
5502
查看次数