将 iPad 应用程序降级为 iPhone 应用程序
我们可以将 iPhone 项目升级为 iPad 项目,如链接中所述: http://developer.apple。 com/library/ios/#documentation/Xcode/Conceptual/iphone_development/120-Building_and_Running_Applications/building_and_running_applications.html
但是,我有一个为 iPad 创建的项目。现在,我想为 iPhone 创建另一个目标(支持与 iPad 相同的操作系统)。我该怎么做?
谢谢和问候, 迪帕
We can upgrade an iPhone project to iPad project as mentioned in the link:
http://developer.apple.com/library/ios/#documentation/Xcode/Conceptual/iphone_development/120-Building_and_Running_Applications/building_and_running_applications.html
But, I am having an project that is created for iPad. Now, I want to create another target for iPhone (supporting OS same as iPad). How do I do this?
Thanks and Regards,
Deepa
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能不想为 iPhone 创建新目标。您想要的是拥有一个单一目标来创建可在 iPad 和 iPhone/iPod touch 上运行的通用应用程序。
首先转到项目设置,并将“目标设备系列”的设置从“iPad”更改为“iPhone/iPad”。
其次,您还需要两个 MainMenu.nib,一个用于 iPad,一个用于 iPhone。您可以在目标的 Info.plist 中执行此操作。键
NSMainNibFile
应该命名 iPHone 的笔尖,添加一个名为NSMainNibFile~iPad
的键来命名 iPad 的笔尖。现在应用程序已准备好在两台设备上运行(直到您尝试在手机上使用
UIPopoverController
或其他 iPad 特定类)。剩下的工作只是为了让自己赏心悦目,一时一景。使用运行时检查
[UIDevice currentDevice].userInterfaceIdiom
在运行时检查您正在运行的设备类型。选择不同的笔尖来加载,以及其他用户体验差异。You probably do not want to create a new target for iPhone. What you want is to have a single target that creates a universal application that runs on both iPad and iPhone/iPod touch.
First go to the project settings and change the setting for "Target Device Family" from "iPad" to "iPhone/iPad".
Secondly you will also need two MainMenu.nibs, one for iPad and one for iPhone. You do this in the Info.plist for your target. The key
NSMainNibFile
should name the nib for iPHone, add a key namedNSMainNibFile~iPad
to name the nib for iPad.Now the app is ready to run on both devices, (until you try to use
UIPopoverController
or other iPad specific class on the phone). Rest of the work is just to make it pleasant, one view at the time.Use the run-time check
[UIDevice currentDevice].userInterfaceIdiom
to check at run-time what kind of device you are running. To choose different nibs to load, and other user experience differences.