简体   繁体   English

使iPhone应用程序通用

[英]Making iPhone app universal

I am closing in on the end of my project, but now I am trying to add universal compatibility so iPad users can use it too. 我即将结束我的项目,但是现在我试图添加通用兼容性,以便iPad用户也可以使用它。 I have chosen universal in my project settings and duplicated the storyboard. 我在项目设置中选择了通用,并复制了故事板。 The problem is everything is way too messed up. 问题是一切都太混乱了。 So I figured I would have to do it manually. 因此,我认为我将必须手动执行此操作。 I made a copy of the iPhone storyboard and named it differently and put it in my application. 我制作了一个iPhone情节提要的副本,并以不同的方式命名它,并将其放在我的应用程序中。 This is where my question is. 这是我的问题所在。 Is there a way to make the iPhone size UIViews iPad views? 有没有一种方法可以使iPhone的大小UIViews iPad视图? So like converting the iPhone view to an iPad view. 就像将iPhone视图转换为iPad视图一样。 After this I could reposition and resize everything. 在此之后,我可以重新定位并调整所有内容的大小。 So is there a way? 那有办法吗? Or will I need to make each view over again in iPad size? 还是我需要以iPad尺寸重新制作每个视图?

I recommend using Auto Layout if you are not using it yet and your target platform supports it. 如果您尚未使用自动版式并且目标平台支持它,我建议您使用它。 Auto Layout is a subsystem that automatically rearranges your views when the screen frame changes, according to a set of constraints that you specify, either programmatically or in your storyboard. 自动布局是一个子系统,当您更改屏幕框架时,该子系统会根据您指定的一组约束(以编程方式或在情节提要中)自动重新排列视图。

Here's the official documentation: https://developer.apple.com/library/mac/documentation/userexperience/conceptual/AutolayoutPG/Articles/Introduction.html 这是官方文档: https : //developer.apple.com/library/mac/documentation/userexperience/conceptual/AutolayoutPG/Articles/Introduction.html

However, there will still be some screens that you should design independently for iPhone and iPad. 但是,仍然会有一些屏幕应为iPhone和iPad独立设计。 That's because Apple design guidelines encourages the use of different designs for iPhone and iPad (ie. an iPad app is not simply an enlarged iPhone app). 这是因为苹果公司的设计准则鼓励在iPhone和iPad上使用不同的设计(即iPad应用程序不仅仅是简单的iPhone应用程序)。 You will probably need to use different controllers to present the model (a UIPopoverController oa UISplitViewController in iPad, for example). 您可能需要使用不同的控制器来呈现模型(例如,iPad中的UIPopoverController UISplitViewController )。 I suggest spending some time thinking about how your iPad app will behave. 我建议花一些时间思考iPad应用程序的行为。 Read the documentation to know about the view controllers that are unique to the iPad. 阅读文档以了解iPad特有的视图控制器。

And finally, here's some guidance from Apple about creating universal apps: https://developer.apple.com/library/ios/DOCUMENTATION/iPhone/conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html 最后,这是苹果公司关于创建通用应用程序的一些指导: https : //developer.apple.com/library/ios/DOCUMENTATION/iPhone/conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html

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

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