适用于Potrait的不同Xib和适用于iPad的横向模式 [英] Different Xib's for Potrait and Landscape mode for iPad

查看:119
本文介绍了适用于Potrait的不同Xib和适用于iPad的横向模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怀疑使用2个XIb来改变Ipad的方向。这是正确的做法。对于Ipad在纵向模式中我有一个设计和横向模式我有不同的设计(很少类似于potrait,但不能在potrait调整)。我可以做任何编程或使用2 Xib的罚款,有什么复杂性或者我在使用2个Xib时应该面对的问题?

I have doubt in using 2 XIb's for one class changing on orientations for Ipad.Is it right practice to do. For Ipad in Portrait mode i have one design and for landscape mode i have different design(little similar to potrait ,but cant adjus't in potrait).Can i do everything in programming or its fine in using 2 Xib's ,what are the complexities or issues i should face in using 2 Xib's ?

推荐答案

如果你问是否使用两个NIB作为你的方向是标准做法然后答案是否定的。

If you're asking if using two NIBs for your orientations is standard practice then the answer is no.

如果您的横向和纵向用户界面根本不同那么这将是一种更可接受的方法。但是你可以轻松地使用一个内部有两个视图的NIB(一个用于横向,一个用于纵向)。

If your UIs for landscape and portrait are radically different then it would be a more acceptable approach. But you could easily just use a single NIB with two views inside it (one for landscape, one for portrait) instead.

Apple提出的可接受的设计模式是您的视图控制器管理横向和纵向方向,并调整其视图(使用自动调整遮罩,并连接到各种委托旋转时触发的方法来添加/删除/动画视图)或用其他内容替换视图。

The accepted design pattern that Apple put forward is your view controller manages both landscape and portrait orientations, and either adjusts its view (using autoresizing masks, and also hooking into the various delegate methods triggered upon rotation to add/remove/animate views) or replaces the view with something else.

如果您的横向/纵向视图非常不同我建议拥有一个NIB,里面有两个视图(一个用于横向,一个用于纵向),并在检测到旋转时在视图控制器中添加/删除这两个视图。

If your landscape/portrait views are quite different I'd recommend having a single NIB with two views inside it (one for landscape, one for portrait) and adding/removing those two views inside your view controller when you detect rotation.

'标准练习'总是很难定义,也许有些人会不同意我,但我当然没有看到任何使用两个NIB的应用程序横向/纵向方向,我还没有看到任何Apple示例代码。希望这有帮助!

'Standard practice' is always quite difficult to define, and perhaps some people will disagree with me, but I certainly haven't seen any apps that use two NIBs for their landscape/portrait orientations, and I haven't seen any Apple sample code that does it either. Hope this helps!

这篇关于适用于Potrait的不同Xib和适用于iPad的横向模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆