简体   繁体   English

我应该为 iOS 应用准备多大的基本图像大小?

[英]How base image size should I prepare for iOS app?

I'm an iOS developer and usually use Swift.我是一名 iOS 开发人员,通常使用 Swift。 Recently I wonder how base image size should I use for apps in iOS.最近我想知道我应该为 iOS 中的应用程序使用多少基本图像大小。

Now I prepare images based on 640x1156 (iPhone SE size) for all apps (For example, I use the background image which is 640x1156).现在我为所有应用程序准备基于 640x1156(iPhone SE 大小)的图像(例如,我使用 640x1156 的背景图像)。 But some people say I should use 750x1334 (iPhone 6,7,8 size) because if use images in iPhone SE size, these quality looks a little low.但有人说我应该使用 750x1334(iPhone 6、7、8 尺寸),因为如果使用 iPhone SE 尺寸的图像,这些质量看起来有点低。 In addition, only few people use iPhone SE.此外,只有少数人使用 iPhone SE。

Which size image should I use?我应该使用哪种尺寸的图像?

UPDATE更新

I use background Image and other objects (the 6 squares) and it look different depends on the device, when use iPhone 6s and iPhone X.我使用背景图像和其他对象(6 个方块),当使用 iPhone 6s 和 iPhone X 时,它的外观因设备而异。

iPhone 6s iPhone X

class Constants {

    //width of base design size
    static let guiPartsWidthOnDesign = CGFloat(750.0)

    //ratio for layout
    static var guiPartsMultiplier: CGFloat = UIScreen.main.bounds.width / (Constants.guiPartsWidthOnDesign / 2.0)

    //detect safe area
    static let safeArea = UIApplication.shared.delegate?.window??.safeAreaInsets.bottom

}

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

    self.view.frame = CGRect(x: 0,
                             y: 0,
                             width: self.view.frame.size.width,
                             height: self.view.frame.size.height)

        //backgrond
        let background = UIImageView.init(frame: UIScreen.main.bounds)
        background.center.x = self.view.frame.size.width/2
        background.image = UIImage(named:"BG")
        background.contentMode = UIViewContentMode.scaleAspectFill
        self.view.insertSubview(background, at: 0)

        //downleft blue button
        let blueButton = UIImageView.init(frame: CGRect(
            x: 64/2*Constants.guiPartsMultiplier,
            y: self.view.frame.size.height-(52/2+34/2)*Constants.guiPartsMultiplier-Constants.safeArea!,
            width: 60/2*Constants.guiPartsMultiplier,
            height: 52/2*Constants.guiPartsMultiplier))
        self.view.addSubview(blueButton)
        blueButton.backgroundColor = UIColor.blue

        //green button
        let greenButton = UIImageView.init(frame: CGRect(
            x: (60/2+64/2+128/2)*Constants.guiPartsMultiplier,
            y: self.view.frame.size.height-(52/2+34/2)*Constants.guiPartsMultiplier-Constants.safeArea!,
            width: 60/2*Constants.guiPartsMultiplier,
            height: 52/2*Constants.guiPartsMultiplier))
        self.view.addSubview(greenButton)
        greenButton.backgroundColor = UIColor.green

        //cyan button
        let cyanButton = UIImageView.init(frame: CGRect(
            x: (64/2+(60/2)*2+(128/2*2))*Constants.guiPartsMultiplier,
            y: self.view.frame.size.height-(52/2+34/2)*Constants.guiPartsMultiplier-Constants.safeArea!,
            width: 60/2*Constants.guiPartsMultiplier,
            height: 52/2*Constants.guiPartsMultiplier))
        self.view.addSubview(cyanButton)
        cyanButton.backgroundColor = UIColor.cyan

        //4 blue buttons
        for i in 1..<5 {
            let subBlueButton = UIImageView.init(frame: CGRect(
                x: 64/2*Constants.guiPartsMultiplier,
                y: self.view.frame.size.height-((43.0+CGFloat(50*i))*Constants.guiPartsMultiplier)-Constants.safeArea!,
                width: 60/2*Constants.guiPartsMultiplier,
                height: 52/2*Constants.guiPartsMultiplier))
            self.view.addSubview(subBlueButton)
            subBlueButton.alpha = 1.0
            subBlueButton.backgroundColor = UIColor.blue
        }

        //down bar
        let bar = UIImageView.init(frame: CGRect(
            x:0,
            y: self.view.frame.size.height-50,
            width: self.view.frame.size.width,
            height: 50))
        bar.alpha = 0.3
        bar.backgroundColor = UIColor.blue
        self.view.addSubview(bar)
}

UPDATE2更新2
My assets are:我的资产是:

资产

UPDATE3 Caring about safe area, it looks like this on iPhone X and it's completely different to the one on iPhone 6s.... UPDATE3关心安全区域,它在 iPhone X 上看起来是这样的,它与 iPhone 6s 上的完全不同......

iPhone 6s

iPhone X

Please follow this link https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/请点击此链接https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/image-size-and-resolution/

In Xcode select your assets folder --> in bottom click + symbol --> select New Image Set --> set name for that --> Now drag and drop 1x, 2x and 3x size of images.在 Xcode 中选择您的资产文件夹 --> 在底部单击 + 符号 --> 选择新图像集 --> 为其设置名称 --> 现在拖放 1x、2x 和 3x 大小的图像。 Here see for this image sizes explanation What should image sizes be at @1x, @2x and @3x in Xcode?此处查看此图像尺寸说明Xcode 中的 @1x、@2x 和 @3x 图像尺寸应该是多少? (You should follow this link for all devices image sizes) (您应该按照此链接查看所有设备图像大小)

iPhone X, iPhone 8 Plus, iPhone 7 Plus, and iPhone 6s Plus @3x iPhone X、iPhone 8 Plus、iPhone 7 Plus 和 iPhone 6s Plus @3x

All other high-resolution iOS devices @2x所有其他高分辨率 iOS 设备 @2x

My screen shots我的屏幕截图

在此处输入图片说明

In this screen shot select New Image set在此屏幕截图中选择新图像集

在此处输入图片说明

Here you need to set your image name and drag and drop images在这里你需要设置你的图像名称和拖放图像

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

相关问题 如何在iOS应用程序编码中获取图像大小 - how to get the image size in ios app coding 通用应用程式ios的图片大小? - Image size for universal app ios? 我应该如何与iPhone应用程序中的单词基础进行交互? - How should i interact with a base of words in iPhone app? 如何在支持iPad和iPhone的iOS中准备图像资产? - How To Prepare Image Assets in iOS supporting both iPads and iPhones? 无法准备要提交的iOS应用 - Cant prepare iOS app for submission 如何从Xcode 3.2为iPhone 5支持准备iOS 4.2应用程序? - How to prepare iOS 4.2 app from Xcode 3.2 for iPhone 5 support? 我应该使用xcassets还是只是更改一个图像的大小以在iOS中的多个设备上进行开发? - Should I use xcassets or just change the size of one image to develop on multiple devices in iOS? iOS到php服务器的文件上传-我应该允许什么文件大小的图像? - iOS to php server file upload - what file size image should I allow? 我应该如何理解Xcode for iOS应用程序中的“保存开发部署”? - How should I understand “Save for Development Deployment” in Xcode for iOS app? 我应该如何将ios应用程序安装到公司的设备上? - How should I install my ios app to devices in the company?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM