Block external Window (TV-Out) from changing orientation - iphone

I'm playing around with the TV-out Adapter for the iphone. My goal is to have an external window display on my tv in order to play movies from my iphone.
the big problem I've got now, is that if the phones orientation changes (physically) the window that shows on the tv turns as well. which is of course unwanted behaviour..
So far i return NO from shouldAutoRotateToInterfaceOrientation. But it still turns and turns.
I'm very grateful for any help on that topic
cheers
sam..

Ah well the solution was rather simple.
I had to assign a RootViewController to the Window that I'm using. Said Rootviewcontroller then needs to implement a shouldAutoRotateToInterfaceOrientation Method (that of course returns NO).

Related

IPhone disable/hide scrubbar mpmovieplayercontroller in fullscreen mode

I'm creating an iphone app with video clips (among other things) where I need to play one or more ads before the actual video clip. Naturally my client doesn't want users to be able to fast forward during the ads but at the same time they must be able to exit the view so I cant set controlStyle to MPMovieControlStyleNone.
I would prefer not to hack the default view and remove the scrubbar so it seems my only option is to implement a custom bar with a single "Done"/"Back" button.
I've googled my eyes out trying to find example code for this, but no dice. I've seen similar questions posted here as well but no answers are given that could help me out. I'm a novice IOS developer and could really use som help with this (custom control bar with single "Done" button for fullscreen MPMoviePlayerController that shows/hideson tap OR disable scrubbar in an acceptable fashion – in fullscreen mode).
Anyone done this before or know where to find some example code? Thanks!

Fade To Black When iPhone is Set Face Down

As a new AppDeveloper, I've never used orientation. So, I would like to try to learn with a simple task. What I want to do is have the screen fade to black when the device is set face down. Is that something that would be simple to do, that perhaps somebody could assist me in, or provide helpful information?
Thanks! :D
Your help is appriciated
You can use orientation (using the XYZ values when the screen is face down). I do not recommend this, because your screen will fade out even if a user is using the app while lying down, and staring up at the screen.
There is an easier and cleaner way. Notice how during phone calls, having the phone close to your ear blacks out the screen?
You can access that property by monitoring the proximityState property of UIDevice. Details here
Doing something like:
BOOL closeToUser = [[UIDevice currentDevice] proximityState];
will assign a YES to closeUser when the device is face down on a surface of some kind, and a NO when it is not
If the value is YES, you can invoke code to do whatever you want.

iPad UIInterfaceRotation is 0, rotation messed up on app-start

i guess i missed something really important in the apple manuals which causes me having this problems.
I will describe what i want to have and what i get instaed + what i do.
Preamble:
goal of my work is a app having a login-screen. this screen is supposed to be placed ontop of all other views, to fade out later. so in this case i guess i already break a rule, in case i understood that "only-one-main-window-guideline" correctly.
What i want:
having an universal application √ check
having an universal application which has UIInterfaceRotation for iPad only √ check
not having troubles regarding uiinterfaceorientation or uideviceorientation on startup allowing me to show all views in proper dimension without having to rotate a few times to have it all properly positioned. - not checked
What i get:
when i start the app in landscape, which is default orientation from my views in interface-Builder, its perfeclty aligned and i can rotate all i want, its perfect, stays perfefct, hooray
when i start the app in portrait, i see the landscape-views flying around on the screen - each time on diffrent pace - at least that seems like. when i rotate the app now, forth and back, its all aligned as it should - also perfectly as wanted.
What i do:
99% of all rotation-related settings is made in interface builder, i currently just have some did-change-methods to change background-images when rotation is done and so on.
i noticed, that even when i build the screen after device knows its orientation, it leads to this.
so in other words:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[self addEventListener:UIDeviceOrientationDidChangeNotification sel:#selector(buildScreen)];
....
note: addEventListener is a small notification-category i created for easier handling. so no magic in here.
in build-screen i add all subviews.
at first, the actualy screen in the background, this screen will get the login as subview (which does not matter since when i add login to main-window itself, situation is the same).
So in this case, i really dont know what do do next.
Once orientation-alignment is setup, it all fits perfectly as i defined in IB.
Any help, links, code, etc, appreciated. thank you very much! i tried searching for this, just found many similar problems, no solutions. so a little sorry in case i seem to ask the very same question, a big one if i really do.
Best Regards
I wouldn't normally recommend this because i think it's annoying as a user, but you could try the Info.plist setting
Initial interface orientation
and set this to the Landscape if this is what works for you.
Could be a temporary workaround. I recon your issues are much more complex though than a simple suggestive fix.
I did not find a proper solution, so i used multiple-xib files to get it done. It's annoying but it works well.

iPhone SDK - Expanding Buttons like in the camera app

I am curious as to whether or not there is an open source solution to replicate the flash button in the iOS camera applicaiton.
I have seem many other apps use this, but there doesn't seem to be a native way, so I assume there is a common source out there.
It is possible to get the flash button by using UIImagePickerController class, but most of the camera apps out there don't seem to be using this (or perhaps they subclass it, which is against apple's terms).
I am looking for a way to replicate the expanding behavior of the button. Any thoughts?
It doesn't sound too hard.
The way I'd do it is to separate the right curve of the button (as images), and make a UIView that has the left part of the button and the right curve as subviews.
When it's tapped, slide the right curve and animate the extra buttons in.
You could use a stretchable UIImage (see UIImage documentation) and then just animate the frame changing.
In the Apple 2010 WWDC Sample code (downloadable via iTunes, otherwise I'd post it here), there are several sample applications which use this control. They call the class ExpandyButton. I realize I'm answering my question, but hopefully someone out there can find this useful.
While looking for a similar solution to this problem I came across this code which was extremely helpful. Similar to ExpandyButton it fit my needs better.
https://github.com/ddebin/DDExpandableButton

iPhone/ iPad app development TV Out

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.