我正在开发一个应用程序,在该应用程序中单击按钮时,我必须将一个类控制器视图显示为子视图。我已将我的视图控制器添加为子视图,它工作正常。
TempViewControlleriPad *tempScreen=[[TempViewControlleriPad alloc]initWithNibName:@"TempViewControlleriPad" bundle:nil];
[self.view addSubview:tempScreen.view];
[tempScreen viewWillAppear:NO];
现在,当我旋转设备方向时,我的子视图没有响应该方向意味着我的子视图没有旋转。
TempViewControlleriPad orientation method:-
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
[[NSBundle mainBundle] loadNibNamed:@"TempViewControlleriPad" owner:self options:nil];
}
else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
[[NSBundle mainBundle] loadNibNamed:@"TempViewControlleriPadLandscape" owner:self options:nil];
}
return YES;
}
请建议我应该怎么做才能解决这个方向问题。
提前致谢。