我正在尝试在iPad应用程序中支持多个方向,并且设计者提出的视图无法仅使用spring / struts模型进行设置。我已经在两个单独的nib文件中布局了视图,目前使用了以下...
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration;
{
if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
{
[[NSBundle mainBundle] loadNibNamed:@"ConfigureViewController-Portrait" owner:self options:nil];
}
else
{
[[NSBundle mainBundle] loadNibNamed:@"ConfigureViewController" owner:self options:nil];
}
}
这是有效的,但正如预期的那样,有点偏慢。有没有办法缓存这个结果?或者是否有某种方法可以完成我缺少的整个过程。只持有从它返回的顶级对象并没有多大帮助,因为我需要NIB知道如何连接所有内容。
答案 0 :(得分:0)
使用自定义视图控制器和主要滥用IB标签系统解决了这个问题。