小编San*_*rya的帖子

如何在swift中以编程方式检查iphone 4和iphone 5的屏幕尺寸

我需要将此Objective-C替换为Swift.有没有人对如何转让有任何建议?

if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
    CGSize result = [[UIScreen mainScreen] bounds].size;
    if(result.height == 480)
    {
        // iPhone Classic
    }
    if(result.height == 568)
    {
        // iPhone 5
    }
}
Run Code Online (Sandbox Code Playgroud)

objective-c swift

50
推荐指数
6
解决办法
4万
查看次数

标签 统计

objective-c ×1

swift ×1