[[UISreen mainscreen] bounds] 不能填充满界面问题

本文介绍了两种解决在不同iPhone型号上界面边缘填充不全的方法。一种是使用Asset Catalogs来管理启动图片,Xcode会在创建新项目时自动生成;另一种是手动添加不同分辨率的默认启动图片到项目中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

以前用iphone4调试界面的时候用[[UISreen mainscreen] bounds]  这个可以刚好填充慢(周围不会出现黑边框)

但是如果到了其他的平台的话  iphone5.。iphone6  就会出现边缘填充不到问题

这里的解决方法有两个

1. Use Asset Catalogs

When you create a new project, there's this thing called an asset catalog which stores your launch image files. Add one of these to your project and presto!

2. Dig out some old files

If you've been around XCode for a while, you'll know that in one of the later versions of XCode 4.x, the app automatically created three default launch image files for your app called Default.pngDefault@2x.png, and Default-568h@2x.png. You need these files in your app, which are essentially just black images with the resolutions 480x320960x640, and 1136x640, respectively (note that these are in HxW, not WxH).

  1. Add these files to your "Supporting Files" group
  2. Go to the project properties and select "Don't Use Asset Catalogs" from the Launch Image section
  3. Delete the Asset Catalog

第一个意思是说  launchscreen.xib  这个文件会包括这个界面的大小配置信息   xcode6 会自动生成   其他的版本不知道有没有,所以保留这个文件不要删除

这样使用[[UISreen mainscreen] bounds]   就能有刚好匹配当前的界面文件。

第二个意思是说


ps:有问题问google    百度就呵呵了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值