UIModalPresentationFullScreen不工作在iPad横向模式? [英] UIModalPresentationFullScreen not working in iPad landscape mode?

查看:868
本文介绍了UIModalPresentationFullScreen不工作在iPad横向模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我添加了ViewvController(B)作为ViewController(A)的子视图。在ViewController A(SuperView)UIModelPresentationFullScreen工作正常。但是当我在ViewController B(SubView)中调用UIModelPresentationFull时,它的模型视图显示在肖像模式,并且也没有完全查看。如何解决这个问题。可以任何人帮助我。我已经尝试了2天。



这是我在superview和subview中尝试的...

  picFBCapture * fbCapt = [[picFBCapture alloc] init]; 
//[self.navigationController pushViewController:fbCapt animated:YES];
//fbCapt.modalPresentationStyle = UIModalTransitionStyleFlipHorizo​​ntal;
fbCapt.modalTransitionStyle = UIModalPresentationFullScreen;
[self presentModalViewController:fbCapt animated:NO];
[fbCapt release];感谢提前..

解决方案

问题是,如果添加一个视图控制器作为一个子视图,它没有连接到视图控制器层次结构,因此某些事情不工作。你应该尽量避免添加视图控制器作为子视图,因为这不是苹果想要使用的视图控制器,但有时它是不能避免的。



是其中一种情况,当它不能避免你应该保存一个引用来查看控制器A在视图控制器B,然后调用 presentModalViewController:在视图控制器A连接到视图控制器层次结构)而不是 self (查看控制器B,未连接)。



EDIT :在控制器A中,您可能有代码看起来像:

  [self.view addSubview: controllerB.view]; 

结合此行添加:

  controllerB.controllerA = self; 

我希望你知道如何创建属性,但如果不是这里的提示:

  @property(nonatomic,assign)UIViewController * controllerA; 

其余的应该可以使用Google和文档找出。


I have added a ViewvController(B) as subview on ViewController(A). In ViewController A(SuperView) UIModelPresentationFullScreen working fine. But when am calling UIModelPresentationFull in ViewController B(SubView) it modelview showing in Portrait mode and that is also not fully viewed. How to solve this problem. Can any one help me please. I have tried 2 days.

This is what I tried in both the superview and subview...

picFBCapture *fbCapt = [[picFBCapture alloc] init];
//[self.navigationController pushViewController:fbCapt animated:YES];
//fbCapt.modalPresentationStyle = UIModalTransitionStyleFlipHorizontal;
fbCapt.modalTransitionStyle = UIModalPresentationFullScreen;
[self presentModalViewController:fbCapt animated:NO]; 
[fbCapt release]; 

Thanks in advance..

解决方案

The problem is that if you add a view controller as a subview it's not connected to the view controller hierarchy and thus certain things doesn't work. You should avoid adding view controllers as subviews whenever possible, since this is not how Apple intend view controllers to be used, but sometimes it can't be avoided.

If this is one of those cases when it can't be avoided you should save a reference to view controller A in view controller B and then call presentModalViewController: on view controller A (that is connected to the view controller hierarchy) instead of self (view controller B, that isn't connected).

EDIT: In controller A you probably have code looking something like:

[self.view addSubview:controllerB.view];

In conjunction to this line add:

controllerB.controllerA = self;

I hope you know how to create properties, but if not here's a hint:

@property (nonatomic, assign) UIViewController *controllerA;

The rest you should be able to figure out using Google and the documentation.

这篇关于UIModalPresentationFullScreen不工作在iPad横向模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆