How do "Photo Booth" and "Measure" (iPad) move the home indicator - ios

Both the "Photo Booth" and "Measure" apps (in camera mode) on the iPad keep the home indicator at the bottom, doing only subtle changes to the UI elements, and a simple animation on orientation change. Both are camera feeds, so the effect is that the feed is always oriented the same as the camera.
I want to do something similar but I'm not sure how to set up the app (ObjC) without fully changing the orientation, and then rotating the parent view the opposite direction.
My context is a game where we use gravity so that down is always down. This works, the player can infinitely rotate their phone in the vertical plane, but it's incompatible with the normal approach to supportedInterfaceOrientations.

Related

Swift SpriteKit: Recognize multiple taps

I have a game and at the moment there is an AI player and human but I want to make it multiplayer. The game is designed where when you press the top left/right the sprite on top would move left/right and if you press the lower left/right the lower sprite would move towards the left/right. Imagine the iPhone to always be in portrait mode.
The issue is that I am using touchesBegan and I can't figure out how to make that work with possible multiple taps coming in at the same time

cocos2d 3.x prevent screen rotation

I am using Cocos2d 3.x and I want the screen orientation to be completely locked. I am creating an app that uses the accelerometer information to move a sprite in the x and y directions. When I lean the screen forward too far, the screen switches from landscape orientation with the button on the left to landscape orientation with the button on the right. I never want this to happen; I always want the orientation to remain landscape orientation with the button on the left. I would assume this is easy to do, and it has already been answered, but after searching for quite some time I still can't figure it out. Any suggestions? Thanks.
OK, I finally figured it out. In the function supportedInterfaceOrientations in CCDirectorIOS.m I always return the value UIInterfaceOrientationMaskLandscapeLeft.

Force rotation without user knowing

My app allows a user to create an invoice. Data can be input in either landscape or portrait.
The user is then able to save the quote and view saved quotes in a collection view. Similar to Pages on iOS. The size of the tiles are the aspect ratio of the device in portrait view.
So if the user saves a quote I generate a screen shot of the view and save it so that it can be viewed in the tiled view (like iOS pages). This works all fine if the user saves when the device is in portrait. If they save while landscape it sucks.
So my question is, there a way I can rotate the view behind the scenes, generate a UIImage from it all without the user knowing noticing any orientation change.
If you are running the code that rotates it and takes a screenshot in the same thread then as long as you rotate it back before the thread finishes running, the device's screen will not update. Simply rotate everything (or if you have too many objects to rotate, take a screenshot of it all then rotate that screenshot) now take a screenshot of your new rotated view (or if you took a screenshot and rotated it don't do anything, you're done) then rotate everything back (again unless you just took a screenshot then rotated that)... If you need a screenshot method that can run in 1 thread use the CGContext code.
(To answer your question, rotating is always behind the scenes, it only becomes "in front" of the scenes when your thread ends... so if you rotate it back before the end of your thread the user will never see it because the device's screen will not update until after it has been rotated twice, there and back again.... bingo!)

UIStatusBar + toggling full frame video + rotations = frame problems

My video (AVPlayer instance) plays in a smaller "minimized" window to start. Touch the screen to show the controls, and allow the user to expand it to full screen, which covers the status bar. I'm giving the viewController this for its full frame:
[[UIScreen mainScreen] bounds]
But the viewController still thinks the status bar is there, even if I hide it first:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]
So the video screen starts below the unseen status bar, at (0, statusBarHeight). If I rotate the device with the controls visible (which makes the status bar visible), the problem remains. If I rotate the device when controls are hidden (and the status bar is missing), everything corrects itself, and the video window starts at (0,0) as expected.
My solution has been to start the full screen video window at (0, -statusBarHeight), then watch for a rotation with no controls, when I can then put the video window back to origin. Yuck.
When I minimize the video back to the original size, if there has been a rotation with no controls, the video window will be too high by (statusBarHeight) pixels.
So another boolean to tell me, when I minimize the video, if I should correct it's "real" position by (0, +statusBarHeight). Double yuck.
If, at this point, we rotate the device, everything is good. But if we instead maximize the video right away, then the full screen video is too high by (statusBarHeight) pixels. Triple yuck!
Okay, more booleans, but this is all complicated by the fact that the video engine is a separate framework, and the 'controlling app' also has similar problems.. AAH!
Am I going about this in the wrong way? It's just getting all too complicated and fragile. I know (by looking at other apps out in the wild) that this is a common problem - I have a list of apps that exhibit the same behaviour. Is there a better way?
I wrote a very simple app to recreate this problem, and used up a "Technical Support Incident" to ask Apple's Developer Technical Support about it. They advised me to file a bug report (ID 12685127). They say:
AVPlayer is definitely not taking into account the status bar ..
and
I'm afraid I don't see a better solution, other than correcting for this as you are doing now ..

ipad sprite/atlas animation

I have an iPad app, where I need an animation full screen - running in a transparent UIView.
This animation is running every time the user is winning.
The question is, would you go for a sprite animation with a very large image as the source or would you go for a small video clip?
Remember that it has to be transparent - it is starts floating around.
Any input regarding directions is appreciated.
Thanks
I would use a sprite, loading a movie each time user wins is much more expensive than simply showing a sprite.
Besides, to show a video with transparent background you will have to iterato throught all player controller subviews and change backgroundColor like this

Resources