简体   繁体   English

自动布局在iOS7和Xcode 6上不起作用

[英]Autolayout not working on iOS7 and Xcode 6

I've started using Xcode auto layout for my projects. 我已经开始为项目使用Xcode自动布局。
Auto-layout works perfectly when I'm testing on ios8 devices, it the view scales as needed. 当我在ios8设备上进行测试时,自动布局效果很好,它可以根据需要缩放视图。
However, things get a little crazy with ios7. 但是,ios7使事情变得有些疯狂。

When I test my app on an ios7 iPhone 5 simulator, the app doesn't scale-up to the larger screen , 当我在ios7 iPhone 5模拟器上测试我的应用程序时,该应用程序无法放大到更大的屏幕
but only shows the 3.5 inch view, leaving black bars on the top and bottom of the screen . 但仅显示3.5英寸的视图, 在屏幕的顶部和底部保留黑条

I am using a tableView controller. 我正在使用tableView控制器。

How do I scale the tableViewController up so that it fits on a larger screen in ios7? 如何放大tableViewController,使其适合ios7中的更大屏幕?

(Like I've said, my app fits perfectly in ios8, on all screen sizes, but not in ios7. (就像我说过的那样,我的应用在所有屏幕尺寸上都完全适合ios8,但不适用于ios7。
Also, it scales fine on an ios7 ipad.) 另外,它可以在ios7 ipad上很好地缩放。)

thanks. 谢谢。

The Xcode (6) IDE should give a warning about this, that may not be so clear: Xcode(6)IDE应该对此发出警告,但可能不太清楚:

" Applications using Launch Screen Files and targetting iOS 7.1 and earlier 使用启动屏幕文件并以iOS 7.1和更低版本为目标的应用程序
need to also include a Launch Image in an Asset Catalog. 还需要在资产目录中包括启动映像。 "

This means you need to have the proper Launch-Images for the " Retina 4 " screen, 这意味着您需要在“ Retina 4 ”屏幕上拥有正确的启动图像,
which is 640 × 1136 pixels , and it should be configured in the assets-catalog, 这是640×1136像素 ,应该在资产目录中进行配置,
just like your Application-Icons ("AppIcon"), but under " LaunchImage " there. 就像您的应用程序图标(“ AppIcon”)一样,但是在其中的“ LaunchImage ”下。

Once you add this 4-inch-compatible Launch-Image to your application, 将这个4英寸兼容的启动映像添加到应用程序后,
iOS-7 will assume you are properly supporting the " Retina 4 " screen, iOS-7会假设您正确支持“ Retina 4 ”屏幕,
and will launch the application in 4-inch mode. 并将以4英寸模式启动该应用程序。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM