我有一个情况,我创建了两个不同的笔尖,一个在纵向模式,另一个在横向模式.我在视图中有很多设计,所以我不得不选择两个不同的笔尖.现在,我想在界面旋转时切换笔尖
常见的viewController
这样我就可以保留填充值和视图中控件的状态.
现在我正在使用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Override to allow orientations other than the default portrait orientation.
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight ){
[self initWithNibName:@"LandscapeNib" bundle:nil];
}else if(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
[self initWithNibName:@"PortraitNib" bundle:nil];
}
return YES;
Run Code Online (Sandbox Code Playgroud)
}
但它没有改变Nib,它显示了初始加载的笔尖.我猜它是加载但没有显示,因为初始笔尖已经显示,不会被删除.我无法找到使用通用视图控制器处理多个笔尖的解决方案,以便我可以轻松处理控件的功能?