[英]What is the best practices when developing iphone and ipad app together?
I'm gonna create an app that supports both iPhone & iPad. 我要创建一个同时支持iPhone和iPad的应用程序。 Before proceeding, I just want to know the best practices about both app development.
在继续之前,我只想了解有关两个应用程序开发的最佳实践。
Here is some points that I know: 我知道以下几点:
Conclusion: 结论:
Refer the below attached image that will demonstrate clearly. 请参考下面所附的图像,该图像将清晰显示。
Questions: 问题:
This may be a basic question, but I need a clarification for better code pratice. 这可能是一个基本的问题,但是我需要澄清以取得更好的代码实用性。
Thanks 谢谢
It doesn't sound like you need specific page 1 & 2 subclasses, though that depends on exactly what the differences are between the pages on each device. 听起来好像不需要特定的第1页和第2页子类,尽管这完全取决于每个设备上的页面之间的区别。 It may be that a collection view suits your needs better so you can simply set the item width and the layout will organise your content into columns where appropriate.
集合视图可能更适合您的需求,因此您可以简单地设置项目宽度,并且布局会将内容适当地组织为列。
It sounds more like all you need is 2 different container classes for the top level which decides how to display page(s), or more specifically, how many pages to display and where they are on screen. 听起来更像是您需要的是顶层的2个不同的容器类,这些类决定了如何显示页面,或更具体地说,决定了要显示多少页面以及它们在屏幕上的位置。 For iPhone that's really simple, for iPad slightly more complex (mainly due to rotation handling).
对于iPhone来说,这确实很简单,对于iPad,则稍微复杂一些(主要是由于旋转处理)。
Note also that if you create a new master-detail project in Xcode and ask it to support iPhone and iPad you will see that a split view controller is used, optionally, for exactly this situation. 还要注意,如果您在Xcode中创建一个新的主从项目,并要求它支持iPhone和iPad,您将看到针对这种情况(可选)使用了拆分视图控制器。 This bypasses the need for 2 container classes by having the app delegate decide whether to use a 'special' container or not (for iPad).
通过让应用程序委托决定是否使用“特殊”容器(对于iPad),从而无需2个容器类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.