出于某种原因,如果我将ECSlidingViewContoller子类化,它将不会旋转(也不会旋转任何子视图)。
基本上如果我这样做,popUpViewController.view
将不会轮播:
@interface DSlidingViewController : ECSlidingViewController
DPopUpViewController *popUpViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];
[self addChildViewController:popUpViewController];
[self.view addSubview:popUpViewController.view];
[popUpViewController.view setTranslatesAutoresizingMaskIntoConstraints:NO];
NSDictionary *viewDictionary = @{@"view": popUpViewController.view};
NSArray *verticalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|"
options:0
metrics:nil
views:viewDictionary];
NSArray *horizontalConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|"
options:0
metrics:nil
views:viewDictionary];
[self.view addConstraints:verticalConstraints];
[self.view addConstraints:horizontalConstraints];
但是,如果我将界面更改为此,一切都按预期工作。 popUpViewController.view
将旋转并占据整个屏幕。 (但显然这不好,因为我需要ECSliding)。
@interface DSlidingViewController : UIViewController
所以我有两个问题:
popUpViewController.view
以使其行为像UIAlertView
? (必须在ECSliding的leftMenu和topView上方显示。)答案 0 :(得分:0)
您应该转发UIViewController
的方法:
– willRotateToInterfaceOrientation:duration:
– willAnimateRotationToInterfaceOrientation:duration:
– didRotateFromInterfaceOrientation:
从您的self
控制器到您的滑动控制器,或者通过以下方式更好地实现控制器控制:
addChildViewController:
removeFromParentViewController
willMoveToParentViewController:
didMoveToParentViewController:
那会是这样的:
self.popUpViewController = ...
[self addChildViewController: self.popUpViewController];
[self.view addSubview: self.popUpViewController.view];
对于后一种方法,请查看"实现容器视图控制器" UIViewController reference中的部分。