简体   繁体   English

iPhone 4、4s和5在同一情节提要上的布局

[英]Layout for iphone 4, 4s and 5 on same storyboard

I'm making an app for iphone. 我正在为iPhone开发一个应用程序。 My layout can be the same for iphone 4, 4s, and 5 but for the iphone 4 and 4s the only thing that change is space between buttons. 对于iPhone 4、4s和5,我的布局可以相同,但是对于iPhone 4和4s,唯一改变的是按钮之间的间距。 I finished my app and i arrange all storyboard to run well on iphone 5. Now i only have to tell that when the app running on iphone 4 and 4s i have to change the space between the buttons in some views to get all buttons inside screen. 我完成了我的应用程序,并安排所有情节提要板在iphone 5上正常运行。现在,我只需要告诉我,当该应用程序在iphone 4和4s上运行时,我必须更改某些视图中按钮之间的空间,以使所有按钮进入屏幕。 How i can do this? 我该怎么做? I can use auto layout i think but i dont use this. 我可以使用自动布局,但我不使用它。 Its possible to help me? 有可能帮助我吗? I do the things right, doing the design first for iphone 5 and now adapt for iphone 4 or im doing the things in the wrong way. 我做对了,首先为iphone 5进行设计,现在适应iphone 4,或者我以错误的方式做事。

Regards 问候

The IOS6 autolayout it's still a bit "wild" and it will also disable the IOS5 compatibility. IOS6自动版式仍然有点“疯狂”,并且还会禁用IOS5兼容性。 If you don't use autolayout, you can still set some rules in storyboard at size inspector, like tide you buttons to the top or the bottom of the view, so you can control where they go when the screen shrinks. 如果不使用自动布局,则仍可以在大小检查器的情节提要中设置一些规则,例如将潮汐按钮移至视图的顶部或底部,以便在屏幕缩小时控制它们的位置。

A better way is to add subviews to your view, and allow the subviews to shrink and expand (also @ size inspector in storyboard). 更好的方法是在视图中添加子视图,并允许子视图缩小和扩展(在情节提要中也是@ size inspector)。 Then add your buttons to those subviews, tide them to the top, bottom, or let them untied/free if they are placed symmetrically inside the subview. 然后将按钮添加到这些子视图中,将它们调到顶部,底部,或者如果它们对称地放置在子视图中,则将它们解开/释放。

You can simulate quickly with the form factor button in storyboard (right-down corner) to see where the buttons go when you switch the sizes. 您可以使用情节提要(右下角)中的形状因数按钮快速进行仿真,以查看切换大小时按钮的位置。

These methods require zero lines of code, but more work with the storyboard. 这些方法需要零行代码,但情节提要板需要更多工作。

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

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