真的一直困住这个星期。我使用的是ECSlidingViewController,我想要一个视图,可以旋转为横向和纵向,因为它是风景照片,需要利用可用空间,而我不希望应用的其余部分旋转,只是留在风景。[self.view addSubview:_topViewController.view];自转问题
我敢肯定的自转方法没有得到所谓的,因为它使用这种技术来切换到视图...
- (void)setTopViewController:(UIViewController *)theTopViewController
{
CGRect topViewFrame = _topViewController ? _topViewController.view.frame : self.view.bounds;
[self removeTopViewSnapshot];
[_topViewController.view removeFromSuperview];
[_topViewController willMoveToParentViewController:_topViewController];
[_topViewController removeFromParentViewController];
_topViewController = theTopViewController;
[self addChildViewController:self.topViewController];
[self.topViewController didMoveToParentViewController:self];
[_topViewController.view setAutoresizingMask:self.autoResizeToFillScreen];
[_topViewController.view setFrame:topViewFrame];
_topViewController.view.layer.shadowOffset = CGSizeZero;
_topViewController.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
[self.view addSubview:_topViewController.view];
}
而且我initialviewcontroller ...
self.topViewController = [storyboard instantiateViewControllerWithIdentifier:@"Home"];
所以这只是堆叠在顶部,而不是切换到这个视图。因此,它总是听初始视图控制器的旋转方法...
帮助是非常赞赏,因为我说我已经坚持了好几天......
你的问题不清楚。你可以添加一些更多的问题的解释,也许增加一些你的代码。 – foundry
那么,我已经构建了一个应用程序,我想除了一个视图以外的所有视图都是纵向的,所以我添加了自动旋转的iOS6方法,但它们没有被调用为[self.view addSubview:_topViewController.view];添加到堆栈顶部我猜,看看链接,你很快就会明白它是如何工作的。我只需要能够使用自动旋转方法,如 ' - (NSUInteger)supportedInterfaceOrientations, - (BOOL)shouldAutorotate, - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation' – rjg
请不要在问题中喊出来。这很烦人,给别人留下不好的印象。 –