我有一个helloController,它是一个UIViewController,如果旋转设备,我希望它更改它以加载新的 Nib “helloHorizo​​ntal.xib”,我该怎么办?谢谢你。

最佳答案

你可以这样,(我没有xcode,所以这个代码可能不完全准确)

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft)){
WhatYourNewViewClassISCAlled* newView = [[WhatYourNewViewClassISCAlled alloc] initWithNibName:@"NIBNAME" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:newView animated:YES];
}

关于iphone - 旋转设备时如何更换新 Nib ?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3510049/

10-10 05:24