capacitor配置ios应用图标不同尺寸

打开ios/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json

复制代码
​
{
  "images": [
    // iPhone 主屏幕图标(60pt,@2x和@3x)
    {
      "filename": "AppIcon-60@2x.png",
      "idiom": "iphone",
      "platform": "ios",
      "size": "60x60",
      "scale": "2x"
    },
    {
      "filename": "AppIcon-60@3x.png",
      "idiom": "iphone",
      "platform": "ios",
      "size": "60x60",
      "scale": "3x"
    },
    // iPad 主屏幕图标(83.5pt,@2x)
    {
      "filename": "AppIcon-83.5@2x.png",
      "idiom": "ipad",
      "platform": "ios",
      "size": "83.5x83.5",
      "scale": "2x"
    },
    // 设置页图标(29pt,@2x和@3x)
    {
      "filename": "AppIcon-29@2x.png",
      "idiom": "universal",
      "platform": "ios",
      "size": "29x29",
      "scale": "2x"
    },
    {
      "filename": "AppIcon-29@3x.png",
      "idiom": "universal",
      "platform": "ios",
      "size": "29x29",
      "scale": "3x"
    },
    // App Store 展示图标(1024x1024)
    {
      "filename": "AppIcon-512@2x.png",
      "idiom": "universal",
      "platform": "ios",
      "size": "1024x1024",
      "scale": "1x"
    }
  ],
  "info": {
    "author": "xcode",
    "version": 1
  }
}

也要导入相应尺寸的图片

关键参数说明:

  • size:图标逻辑尺寸(单位 pt),如 60x60 表示 60pt,AppIcon-60@2x.png这个图片需要60 * 2=120px的,所以AppIcon-60@2x.png需要120px * 120px尺寸的;AppIcon-60@3x.png需要60 * 3 = 180px,也就是需要180px * 180px的。

  • scale:缩放倍数(1x/2x/3x),实际像素尺寸 = 逻辑尺寸 × 缩放倍数(如 60x60@2x 对应 120x120 像素)

  • idiom:设备类型(iphone/ipad/universal 通用)

配置后需注意:

  1. 确保每个 filename 对应的图片文件已放入 AppIcon.appiconset 文件夹

  2. 运行 npx cap sync ios 同步到原生项目

  3. 清理 Xcode 缓存后重新构建

这样就能适配不同设备的图标显示需求了。

相关推荐
2501_915106321 天前
最新版本iOS系统设备管理功能全面指南
android·macos·ios·小程序·uni-app·cocoa·iphone
游戏开发爱好者81 天前
HTTPS DDoS 排查 异常流量到抓包分析
网络协议·ios·小程序·https·uni-app·iphone·ddos
TouchWorld1 天前
iOS逆向-哔哩哔哩增加3倍速播放(3)-[横屏视频-全屏播放]场景
ios·swift
2501_915918411 天前
iOS 性能监控 运行时指标与系统行为的多工具协同方案
android·macos·ios·小程序·uni-app·cocoa·iphone
00后程序员张1 天前
IPA 混淆技术全解,从成品包结构出发的 iOS 应用安全实践与工具组合
android·安全·ios·小程序·uni-app·cocoa·iphone
@小码农1 天前
2025年厦门市小学生信息学竞赛C++(初赛)真题-附答案
开发语言·c++·python·算法·蓝桥杯
BigPomme1 天前
Flutter IOS 出现实机运行问题和transpoter传包异常
flutter·ios
2501_916008891 天前
IOScer 证书到底是什么和怎么使用的完整说明
android·ios·小程序·https·uni-app·iphone·webview
良木生香1 天前
【数据结构-初阶】详解线性表(3)---双链表
c语言·数据结构·蓝桥杯