在Ipad中使用presentModalViewController的问题 [英] Problem using presentModalViewController in Ipad

查看:160
本文介绍了在Ipad中使用presentModalViewController的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我当前的Ipad应用程序中,我有一个分屏视图,其中详细视图是一个包含4个表视图的滚动视图。我试图实现的功能是,当我在滚动视图中单击表格的任何一行时,会显示一个包含其他信息的屏幕,我使用presentModalViewController尝试获取此功能。

In my current Ipad app, I have a split screen view in which the detail view is a scroll view containing 4 table views. The functionality I was trying to achive was that when I click any row of the table in the scroll view, a screen is show containing additional information and I used presentModalViewController to try to get this functionality.

比方说,我有3个文件aViewController,bViewController,cViewController ..我在我的项目的appDelegate文件中编写splitViewController的代码,我保留3个视图控制器(aViewController,bViewController,cViewController)作为子视图
splitViewController ...

say for example, I have 3 files aViewController, bViewController, cViewController.. I am writing the code for splitViewController in the appDelegate file of my project and I keep the 3 view Controllers (aViewController, bViewController, cViewController) as subviews of the splitViewController...

现在在我的一个ViewControllers中,比如 aViewController ,在其 didSelectRowAtIndexPath ,我添加如下代码

Now in one of my ViewControllers, say aViewController, in its didSelectRowAtIndexPath, I add the code as follows

这就是我做的,

PopOverControllerContents *popContents = 
        [[PopOverControllerContents alloc] 
         initWithNibName:@"PopOverControllerContents" 
         bundle:[NSBundle mainBundle]];
 popContents.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:popContents animated:YES

我想提到的一件重要事情是,我的应用程序的默认方向是横向模式,因此我将PopOverControllerContents的方向更改为横向。

An important thing I want to mention is that, my app's default orientation is landscape mode and hence I changed the orientation of PopOverControllerContents to landscape orientation.

当我构建并运行时以及当我单击中的任何行时aViewController ,一个弹出视图确实会出现,但是它完全不在位,它的底部会被切断。

When I build and run and when I click any row in aViewController, a popup view does come but its totally out of position and its bottom part gets cut off.

有人能告诉我我的意思吗?做错了我怎么纠正呢?

Would anyone be able to tell me what I am doing wrong and How I can correct it?

推荐答案

[UIViewController presentModalViewController ::] 假设您的视图控制器是根控制器,或者它位于控制器层次结构中的某个位置。当你说你的控制器视图是 SplitViewController 的子视图时,它们也是它的子控制器吗?您应该尝试从 SplitViewController 中呈现模态控制器,或检查您的控制器是否是它的子控制器(iOS 5中的新功能)。

[UIViewController presentModalViewController::] supposes that your view controller is the root controller or it is somewhere in the controller hierarchy. When you say that your controller views are subview of a SplitViewController are they also its child controllers? You should try to present the modal controller from the SplitViewController or check that you controllers are it's child controllers (new feature in iOS 5).

这篇关于在Ipad中使用presentModalViewController的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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