iPad Air上的屏幕宽度和高度不正确

时间:2016-05-10 17:30:47

标签: ios ipad

我只是尝试测试我的应用程序。在iPhone和iPad上,我发现iPad Air上的屏幕宽度/高度不正确。

注意:

    CGRect screenBounds = [UIScreen mainScreen].bounds ;
    CGFloat width = CGRectGetWidth(screenBounds)  ;
    CGFloat height = CGRectGetHeight(screenBounds) ;

从上面的代码:我的控制台宽度= 320和高度= 480

我使用以下代码测试iPad Air和iPhone中的宽度/高度

    CGFloat width = 320.0;
    CGFloat height = 480.0;
    CGSize size          = [UIScreen mainScreen].bounds.size;
    CGPoint centerPoint = CGPointMake(size.width/2 - width/2, size.height/2 - height/2);

    UIBezierPath* path = [UIBezierPath bezierPathWithRect:CGRectMake(centerPoint.x, centerPoint.y, width, height)];
    _rectLayer.lineWidth = 2.0f;
    _rectLayer.strokeColor = [[UIColor redColor] CGColor];
    [_rectLayer setFillColor:[[UIColor clearColor] CGColor]];
    [_rectLayer setPath:[path CGPath]];
    [_rectLayer setOpacity:0.5];
    [self.view.layer addSublayer:_rectLayer];

iPad Air,红色边缘未显示在顶部

enter image description here

iPhone 4s,红色边缘随处可见 enter image description here

iPhone 5,红色边缘随处可见

enter image description here

1 个答案:

答案 0 :(得分:2)

  1. 您的应用是仅限iPhone的应用。请注意iPad屏幕右下角的1x / 2x。如果您想支持完整的iPad屏幕,您需要使您的应用程序成为通用应用程序。在Xcode中,选择您的目标。然后转到“常规”选项卡。将“设备”设置从iPhone更改为“通用”。

  2. 根据您的iPhone屏幕截图,您尚未提供正确的启动图像或启动屏幕文件(后者更好)。

  3. 如果没有这两项更改,您的应用只支持3.5“iPhone(Apple不会接受)。