iPhone/ iPad app development TV Out - iphone

HI,
I have just submitted my first application to iTunes for approval, however, there is one thing I really want to add to it ASAP.
I would like to code into an app that it can use the TV Out functions of both the iPhone and iPad? Ideally it would work in a similar way to how keynote works i.e. you see a bit more on the iPad itself than is projected on the TV, but even just mirroring the screen would be a step in the right direction.
I have searched all over for this and all I keep getting is about downloading jailbreaks for you iPhone to mirror the screen, which doesn't really help.
Thanks in advance,

If you just want to mirror, use my TVOutManager singleton. I've put up code to do this on github: https://github.com/robterrell/TVOutManager (Hmmm... I just noticed I haven't pushed the most recent code. I'll review and push new code asap.) I wrote up some detailed info about it at http://www.touchcentric.com/blog/archives/123 if you want to know the how's and why's.
Basically, just add the files to your project, and call:
[[TVOutManager sharedInstance] startTVOut];
If you want to do more than mirroring, read the docs on UIScreen. It's fairly trivial to create a UIWindow on the external screen (steal the bits from TVOutManager if you need to) and add subviews to it. This way you could have a Keynote-like controller on the device screen, while the main display is on the external display.

http://mattgemmell.com/2010/06/01/ipad-vga-output should get you started ...

Mirroring is not possible.
But to draw on an external display, just get the UIScreen object for the external display, then set the screen property of a UIWindow to it, (making sure to set the frame correctly etc) everything in that window should be drawn on the respective display.
Relative links:
developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html (look at screen property)
developer.apple.com/library/ios/#documentation/uikit/reference/UIScreen_Class/Reference/UIScreen.html (look at +screens)
(I don't have any reputation => can't post clickable links)

I think, you can't do this. You can only stream videos from iPod app.
But, if you have jailbreak on your device, try this (link) or take a look at this great YouTube video (link) showing exactly what you need.

Related

iOS - How to show hints for gestures for iOS app?

I have seen some apps where when you launch them for the first time after downloading (e.g. Chrome app on iPhone), it shows you a list of animated gestures on the screen, kind of giving you a tour of the app.
How do I build one something like that? And how does the app know to launch only for the first time after download and not since then? For the second question, I am guessing a "shown=TRUE" value can be saved inside a PList file and checking the value each time when the app finished launching. But I am more curious about the mechanism involved in creating a guided app tour.
You can use transparent and semi-transparent images with a UIImageView, so you can make up an image with arrows and notes and put over the whole screen. You could fade it out when the user taps.
To know if it's the first time running the app, you should use NSUserDefaults instead of a plist; it's much easier, and you should be app to find a quick tutorial on that fairly easily.
Also, you could check around on this site for controls like this one. I haven't used any of them myself, so I'm not sure how much they differ from a regular UIImageView. They look nice though.

How to create a view similar to iPod player?

I'm creating an app that shows a list of items one by one on the screen. Each item will have a name and phone number, and will be displayed in a view called person view. My project is similar to the iPod music player view:
However, instead of showing the album image, I want to show my person view. Could someone explain me how to achieve the navigation when the user hits |<< or >>|? Also, how can I build a similar view? Any code snippet/blueprint would be quite helpful. Thanks!
One thing to keep in mind is that Apple's app store review guidelines contain advice that apps that reproduce iPod controls may be rejected. My guess is that this is probably meant more to discourage apps from using a control like the traditional iPod jog wheel, but it's something you may want to be careful about.

Playing iPhone movies through TV out

Is there any way to emulate the Videos app such that we still maintain controls on the device (iPad/iPhone), but sends the video out through the cables to the TV? I looked into screen mirroring, but it's way too slow for videos, and regardless, the UIGetScreenImage() used by screen mirroring is no longer allowed by Apple.
The Videos app seems to have exactly what I need, but I don't see anything simple to make that happen.
Update (10/15/10): So apparently movies played through UIWebView have TV-Out support, while MPMoviePlayerController movies don't.
http://rebelalfons.posterous.com/iphone-os-support-for-tv-out
However, there is a caveat: this does not work on older devices updated to the most recent iOS. That is, iPod touches, iPhone 3G & 3GS don't work, while iPhone 4 and iPads do. Hoping there's some more stuff that we can use to fill in the gaps in compability, since I know its possible. Apps like AirVideo and StreamToMe currently support this functionality.
I am not sure if there is an official way to do this. But as for your examples, AirVideo uses method Swizzling (check out: http://www.cocoadev.com/index.pl?MethodSwizzling) to override checks in Movie Player, and acting like Videos app
I guess some with some reverse engineering on SDK, you can find where the checks are made, and swizzle that method, with your custom one.
In 3.2 and later (postdating the site you link to), UIScreen has a class method, 'screens' that'll return an array of one object — the main screen — if no external display is available, or two screens — the main screen and the external screen — if a TV lead is connected. The task should be as simple as positioning the views you want to appear on the external screen within its frame and the controls you want on the device within the other.
Have you tried that?
Edited for one additional comment: also as of 3.2, it is explicitly permissible to create an MPMovieController and then grab the view from it to treat as a normal UIView rather than doing a full 'present'. So that's how you'd get a movie view that you can position as you wish.

Output iPad content to external display

I've heard it's possible to output content from an iPad app to an external display, but the app has to be prepared for this and there are serious limitations. Any pointers?
And also, can this be done for iPhone? Is it the same?
As little indicates, you'll need to create a new UIWindow and attach it to the UIScreen for the external display. This UIWindow will host the content to be presented on the external display, so you'll need to build a distinct view hierarchy for that, separate from your main application interface. You also will need to listen for the UIScreenDidConnectNotification and UIScreenDidDisconnectNotification notifications that inform your application when the external display has been attached and removed.
I demonstrate how to do this in the video for the iPad session of my class on iTunes U, for which the course notes can be viewed here.
Matt Gemmell also did a very nice writeup on this recently, which you can read here.
The key to implementing this feature is contained in the UISCreen class:
http://developer.apple.com/iphone/library/documentation/uikit/reference/UIScreen_Class/Reference/UIScreen.html#//apple_ref/occ/clm/UIScreen/screens
Basically, your app will use UIScreen to get access to the external display screen and then set it as the screen for a new UIWindow (your app will have two UIWindows). The app can then add a ViewController to the new UIWindow that represents the second screen and off you go.
UIWindow *externalWindow.screen = [[[UIScreen screens] lastObject] retain];
[externalWindow addSubview:externalViewController.view];
It's pretty simple, but will take a little experimenting to get it working. It's a pain in the butt to debug your app on the device, since the 30-pin connector will be required to connect to the display, so cannot also be used for debugging. Perhaps there is a pass thru cable for allowing debug + external display, but I haven't had a chance to look.
Limitations:
You should be able to output video-quality bit rates, as apple has been able to achieve this with a few of their applications. That said, the external display will be limited to the screen resolution supported by the device, so things might not look crisp on your 108" LCD :-)
Platforms:
This should work on all iPads and on iPhones running 4.0+. You'll need the special cable which I believe is unique for iPhone and iPad ($30-40).

iPhone built-in controller to display a collection of images in cool 3D landscape view

For some reason, I can't seem to locate the documentation for the above support within the foundation. I am talking about the view used by some applications to show a collection of images in a cool 3D view where you can flip through the set, much like the iPod application view of the albums.
You're looking for Cover Flow. I believe it is an unpublished API. However Open Flow is a viable replacement.
OK, found it, it's called CoverFlow - but I also note that it appears that Apple considers this a private API and thus cannot be used for apps on the App Store - can anyone confirm that it is so?