问题
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.
回答1:
From the ExternalDisplay sample code in the iOS Developer Library:
To display content on an external display, do the following:
Use the screens class method of the UIScreen class to determine if an external display is available.
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.
Select the UIScreenMode object corresponding to the desired resolution and assign it to the currentMode property of the screen object.
Create a new window object (UIWindow) to display your content.
Assign the screen object to the screen property of your new window.
Configure the window (by adding views or setting up your OpenGL ES rendering context).
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.
来源:https://stackoverflow.com/questions/11591928/how-to-disable-some-part-to-be-displayed-as-tvout-in-ios-5