繁体   English   中英

iPad Air App在iPad Pro上扩大规模

[英]IPad Air App scaled up on IPad Pro

我已经有一个用于目标设备iPad Air的现有iOS应用,并且希望它可以在iPad PRO上运行。 一切正常,但是我需要一个Image来在两个设备上保持相同的大小(mm上为realSize)。

两种设备的分辨率都相等,所以我不明白为什么iPad Pro上的Image更大。 这就是我绘制图像的方式。

- (void) drawNewNumberImage {
    int index = arc4random()%_allNumbers.count;
    while([_currentNumber  isEqualToString:[_allNumbers objectAtIndex:index]]) {
        index = arc4random()%_allNumbers.count;
    }
    _currentNumber = [_allNumbers objectAtIndex:index];
    int s = _size;
    //_imgView.image = [UIImage imageNamed:[_allNumbers objectAtIndex:index]];
    _imgView.image = [ImageProvider getPDFVectorImage:[_allNumbers objectAtIndex:index] AndFontSize:s];
    CGRect frame = _imgView.frame;

    frame.size = CGSizeMake(s, s);
    _imgView.frame = frame;

    _imgView.center = CGPointMake(CGRectGetWidth(self.view.frame)/2 , CGRectGetHeight(self.contentView.frame)/2);
}

iPad Pro似乎只是在扩展所有App。 有没有一种方法可以禁用此行为。

您可以尝试检测它是否为iPad Pro,并创建所需的新尺寸,否则将使用您的默认默认尺寸。

- (void) drawNewNumberImage {


if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){
CGSize result = [[UIScreen mainScreen] bounds].size;
if(result.height == 1366)
{
    // iPad Pro
    //add your iPad Pro sizes 

}  else {

int index = arc4random()%_allNumbers.count;
while([_currentNumber  isEqualToString:[_allNumbers objectAtIndex:index]]) {
    index = arc4random()%_allNumbers.count;
}
_currentNumber = [_allNumbers objectAtIndex:index];
int s = _size;
//_imgView.image = [UIImage imageNamed:[_allNumbers objectAtIndex:index]];
_imgView.image = [ImageProvider getPDFVectorImage:[_allNumbers objectAtIndex:index] AndFontSize:s];
CGRect frame = _imgView.frame;

frame.size = CGSizeMake(s, s);
_imgView.frame = frame;
_imgView.center = CGPointMake(CGRectGetWidth(self.view.frame)/2 , CGRectGetHeight(self.contentView.frame)/2); 
}

}

如果要针对iOS 8 SDK进行构建,则需要以正确的大小添加启动映像。 否则,Apple会假设您不知道如何在iPad Pro中进行处理,并且会放大所有内容。 检查您的代码在何处获得屏幕尺寸并使用NSLog进行显示; 如果得到1024 x 768,则缺少正确的启动图像。

顺便说一句。 您应该真的, 不要真的像其他答案一样看屏幕的高度或宽度并做出假设,因为在iPad Pro上使用分屏时,您的假设可能非常非常错误,并给您带来麻烦。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM