如何禁用某些部分在iOS 5中显示为TVOut? [英] How to disable some part to be displayed as TVOut in iOS 5?

查看:191
本文介绍了如何禁用某些部分在iOS 5中显示为TVOut?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我们在iOS 5中所知,我们不需要添加TVOut功能的单独代码行。他们已将该功能集成为内置功能。<​​/ p>

我的问题是:如果在我的应用程序中有一些我的自定义视图,我不会想要展示TVOut演示文稿。它应该只在设备上显示,而不是在投影板上显示。



我已经检查了我们用于iOS版本< 5.0的TVOut代码,但它们正在捕获窗口图像并传递它。如何禁止为某些自定义小视图传递尖叫。



欢迎任何建议/解决方案。



观看此视频: http://www.youtube.com/watch?gl= US& v = GysMfb4_79A



如何实现此类目标?



编辑
我使用过Apple提供的ExternalDisplay代码。但我面临一个问题。




  • 该代码适用于单视图控制器,我们将所有视图添加到新窗口。

  • 如果我的应用程序包含这么多视图控制器,并且在某些视图控制器中,我为用户提供了textView。

  • 如何避免在外部窗口上显示那些文本视图作为TVOut,应该显示没有该textView的视图。



请建议我。

解决方案

来自 ExternalDisplay 示例代码:


要在外部显示器上显示内容,请执行以下操作:


  1. 使用用于确定外部显示器是否可用的UIScreen类的屏幕类方法。


  2. 如果外部屏幕可用,请获取屏幕对象并查看availableModes属性中的值。此属性包含
    屏幕支持的配置。


  3. 选择与所需分辨率对应的UIScreenMode对象,并将其分配给该屏幕的currentMode属性。屏幕
    对象。


  4. 创建一个新窗口对象(UIWindow)以显示您的内容。


  5. 将屏幕对象分配给新窗口的屏幕属性。


  6. 配置窗口(通过添加视图或设置OpenGL ES)渲染上下文)。


  7. 显示窗口。



查看示例代码,您将有两个 UIWindow 对象,每个对象都会显示想要在给定显示上显示的视图。所以你可以有一个 UIViewController ,带一个标志 isExternalScreen ,当它为true时,它不会显示某些视图。


As we all know in iOS 5 we don't require to add separate lines of code of TVOut feature. They have integrated that functionality as an in-built feature.

What my question is: What if in my application there are some my custom views available, which i don't want to showcase as TVOut presentation. It should be display on device only, not on projection board.

I have checked the TVOut code which we use for iOS version <5.0, but there they are capturing window image and passing it. How to prohibit to pass screaming for some custom small views.

Any suggestions/solutions are most welcome.

Check out this video: http://www.youtube.com/watch?gl=US&v=GysMfb4_79A

How to achieve such thing?

Edit : I have used ExternalDisplay code given by Apple. But I am facing one issue in that.

  • That code works for single view controller, where we add all our views to new window.
  • What if my application contains so many view controllers, and in some of the view controllers I have textViews for the user.
  • How to avoid to display those text views over the external window as TVOut, there should be display the view without that textView.

Please suggest me.

解决方案

From the ExternalDisplay sample code in the iOS Developer Library:

To display content on an external display, do the following:

  1. Use the screens class method of the UIScreen class to determine if an external display is available.

  2. If an external screen is available, get the screen object and look at the values in its availableModes property. This property contains the configurations supported by the screen.

  3. Select the UIScreenMode object corresponding to the desired resolution and assign it to the currentMode property of the screen object.

  4. Create a new window object (UIWindow) to display your content.

  5. Assign the screen object to the screen property of your new window.

  6. Configure the window (by adding views or setting up your OpenGL ES rendering context).

  7. Show the window.

Looking at the sample code you would have two UIWindow objects, each displays the views that would would like to show on that given display. So you could have a UIViewController with a flag isExternalScreen, and when true it would not show the certain views.

这篇关于如何禁用某些部分在iOS 5中显示为TVOut?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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