iOS 适配各机型启动页LaunchScreen.storybo

2023-02-02  本文已影响0人  switer_iOS

图片适配

1.选择Assets.xcassets—>左下角+号—>New Image Set.然后自己命一个名字

image

2.修改图片的Contents.json文件,修改内容如下(双击图片,选择Show in Finder,文件夹里面有一个Contents.json文件,双击打开)

{"images":[{"idiom":"iphone","scale":"1x"},{"idiom":"iphone","scale":"2x"},{"idiom":"iphone","scale":"3x"},{"idiom":"iphone","scale":"1x","subtype":"retina4"},{"idiom":"iphone","scale":"2x","subtype":"retina4"},{"idiom":"iphone","scale":"3x","subtype":"retina4"},{"idiom":"iphone","scale":"3x","subtype":"736h"},{"idiom":"iphone","scale":"2x","subtype":"667h"},{"idiom":"iphone","scale":"3x","subtype":"2436h"},{"idiom":"iphone","scale":"3x","subtype":"2688h"},{"idiom":"iphone","scale":"2x","subtype":"1792h"}],"info":{"author":"xcode","version":1}}

3.此时就可以根据不同屏幕适配不同的启动图了

image

4.适配完各个屏幕图片后,去LaunchScreen.storyboard搭建启动图

image
上一篇下一篇

猜你喜欢

热点阅读