Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在卸下ModalViewController后将方向设置为正确的设备方向?_Ios_Uiviewcontroller_Rotation_Orientation_Landscape Portrait - Fatal编程技术网

Ios 如何在卸下ModalViewController后将方向设置为正确的设备方向?

Ios 如何在卸下ModalViewController后将方向设置为正确的设备方向?,ios,uiviewcontroller,rotation,orientation,landscape-portrait,Ios,Uiviewcontroller,Rotation,Orientation,Landscape Portrait,我有一个显示内容的详细视图。通过一个按钮,我以模式呈现另一个视图: [self.viewController presentModalViewController:helpViewController animated:NO]; 因此,当我关闭此helpViewController时,detailview始终处于模式。 无法将其定位到正确的设备方向 我尝试过将其旋转到设备方向: if ([UIViewController respondsToSelector:@selector(

我有一个显示内容的详细视图。通过一个按钮,我以模式呈现另一个视图:

[self.viewController presentModalViewController:helpViewController animated:NO];  
因此,当我关闭此helpViewController时,detailview始终处于模式。
无法将其定位到正确的设备方向

我尝试过将其旋转到设备方向:

if ([UIViewController respondsToSelector:@selector(  
    attemptRotationToDeviceOrientation)]) {

    [UIViewController attemptRotationToDeviceOrientation];
}  
在解除helpViewController后,似乎没有在detailView中调用ViewDidDisplay。

那么我如何才能让它工作呢?请尝试将detailview.m设置为

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation 
{
// Return YES for supported orientations
return YES;
//    return (interfaceOrientation == UIInterfaceOrientationPortrait);

}

shouldAutorotateToInterfaceOrientation的返回值已设置为YES,但仍不起作用。那么detailview的父视图如何?因此,在显示帮助视图之前,所有视图都会旋转良好?准确显示帮助视图。就在从helpview返回时,detailview被锁定在portraidMode中。哦,不是这样。但我不知道为什么。这里有什么问题?