ios - 多 View Controller - iOS 7
<p><p>我正在尝试开发一个涉及 TextView 的应用程序。如果我使用 4 英寸尺寸,它会在 3.5 英寸设备上超出屏幕。如果我将大小更改为 3.5 英寸,修复它并将其更改回 4 英寸, TextView 上方会有这个大而丑陋的间隙。</p>
<p>我认为解决这个问题的方法是使用多个 ViewController 。一个用于 3.5 英寸,一个用于 4 英寸。但是我该怎么做呢?我正在使用 Xcode 5,为 iOS 7 开发并在 iPhone 4 上进行测试。</p>
<p>谢谢,
罗马式</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>您不必使用两个 ViewController 。您只需要一些 <strong>Auto Layout Constraints</strong> 或 <strong>autosizing</strong> 掩码来调整 View 以适应不同的屏幕尺寸。以下是一些有用的链接。</p>
<p><strong>关于自动布局的教程:</strong></p>
<p><strong>第 1 部分:</strong> <a href="http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2" rel="noreferrer noopener nofollow">http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2</a> </p>
<p><strong>第 2 部分:</strong> <a href="http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2" rel="noreferrer noopener nofollow">http://www.raywenderlich.com/20897/beginning-auto-layout-part-2-of-2</a> </p>
<p><strong>在 Interface Builder 中使用约束</strong>
<a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraints/WorkingwithConstraints.html#//apple_ref/doc/uid/TP40010853-CH8-SW1" rel="noreferrer noopener nofollow">https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraints/WorkingwithConstraints.html#//apple_ref/doc/uid/TP40010853-CH8-SW1</a> </p>
<p><strong>Apple 自动布局指南</strong> <strong> <a href="https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html" rel="noreferrer noopener nofollow">https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html</a> </strong></p>
<p><strong>关于如何为 4 英寸和 3.5 英寸屏幕设置自动布局约束的类似问题</strong>
<strong> <a href="https://stackoverflow.com/questions/18862476/resize-view-with-auto-layout-between-3-5-and-4-inch-form-factor/18865051#18865051" rel="noreferrer noopener nofollow">Resize view with Auto Layout between 3.5 and 4 inch form factor</a> </strong></p></p>
<p style="font-size: 20px;">关于ios - 多 ViewController- iOS 7,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/18929652/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/18929652/
</a>
</p>
页:
[1]