Five Finger Pinch to Close (Pinch to Home) Black Screen - ios

What is my app supposed to do (or might it currently be doing incorrectly) to support correct visuals when a five finger pinch to close gesture is executed by the user?
When the five finger pinch to close app gesture is performed on my iPad app, the image of my app UI that is used for the shrinking transition is a black screen. There is one exception; when my app is first launched the gesture uses the correct snapshot of my app UI as long as I do not navigate away from the initial screen.
As a test, I added the code below to see if I could get a red screen in all cases. The result was a red screen in the case that used to show my app UI, and still get a black screen in the failure case.
- (void)applicationWillResignActive:(UIApplication *)application
{
UIView *aView = UIApplication.sharedApplication.keyWindow.subviews.lastObject;
UIImageView *imageView = [[UIImageView alloc] initWithFrame:aView.bounds];
imageView.backgroundColor = [UIColor redColor];
[aView addSubview:imageView];
}
I realize this question is vague, but what I am hoping for is insight into where iOS is getting the screen it uses during the pinch to close gesture. Based on the above code there is more to it than applicationWillResignActive.
I am building with Xcode 5.1.1, iOS 7.0 deployment target, problem occurs running on iOS7 and iOS8 (all versions up to and including public release of 8.1).
Edit
If I continue the shrink gesture by pinching further and further, when the thumbnail image of my app gets to about 25% of the screen size, the empty black image snaps to a correct image of my app UI. At that point I can reverse the gesture (spread my fingers apart) and the correct image grows all the way to full screen. During this process, the image is crisp and not scaled.
If I have focus in a text field and tap and hold with one finger to bring up the magnification loupe, then drop my other four fingers and start the shrink, the black screen shows my UI in a circle where the loupe was (rest is black).
As I mentioned in the comments below, a double tap on the home button always yields a correct snapshot for fast app switching.
My app does not have any background threads running and is not requesting specific permissions to run long running tasks in the background.

Any change your app uses -drawViewHierarchyInRect:afterScreenUpdates:YES anywhere? I'm seeing the same issue when using that API. It seems like there are quite a few GPU bugs related to setting afterScreenUpdates to YES.
Changing my app to use renderInContext (cpu instead of gpu) fixed the problem, but doing that introduces other issues, so it's a toss up.

Related

How can I detect if the Launch Storyboard happened?

does anyone know if there is a way to tell if the launch storyboard executed? Or is there a way to detect if the launch image was displayed?
Basically my app consists of just one view controller with some views (all created programmatically), plus the launch storyboard which I added to the project recently which seems to be working OK.
The reason why it would be useful for me to know if the launch storyboard happened is that my app is a game which basically consists of a big 2D scene that you can zoom into and pan around using the usual touch gestures. When the game starts for the first time it starts fully zoomed-out and centered on the scene: so that is what the launch image matches. But the player pans around and zooms-in on various things, so when they press the home button they could be zoomed into any part of the picture. So when they touch the app's icon to relaunch, if the launch storyboard happens it needs to put their pan/zoom position back to the initial centered zoomed-out position (otherwise as soon as the app gets going it would appear to the user to suddenly snap from the initial position represented in the launch image to where they were, not giving a smooth user experience).
What I do at the moment is -- if applicationDidEnterBackground: method gets called I assume that when the user relaunches the app, by touching the icon, that the launch storyboard will be executed. But the launch storyboard doesn't always happen after it hibernated via applicationDidEnterBackground:, especially if it is only a few minutes since the user pressed the home button.... and those times when the launch storyboard does not happen I need not inconvenience the player and put them back to the initial zoomed-out centered position, I could just let them carry on at the position they were.
I've not used storyboards before, but as I understand it launch storyboard are a special case where you can't make any connections to code because your app's not actually running yet, so I can't think of a way to set a variable, for example, to show the story board happened.
Anyone got any ideas?
Cheers,
Jon
Just use the viewDidLoad method provided by the UIViewController.
Just override the method in your ViewController and then you can perform the task you want when your View(Storyboard) is loaded.
Example:
#implementation MyViewController:UIViewController
-(void)viewDidLoad{
//Insert your code here
}
#end

Animation in Launch Screen in xcode 6

I want to animate a set of images in my Launch Screen, but I do not know how. I have seen some tutorials telling me to put code in the App Delegate (DidFinishLaunchingWithOptions) and nothing has worked.
Could someone help me animate my Launch Screen?
I am supposing that you do quite a bit of work on launch, and you do not want your user to stare at a static image while this work is going on. What you need to do is do the work in the background (using gcd). This way, the launch screen will be gone quickly. However, you are not ready of course: hence your need for animations. So what I do is add my own equivalent of the start screen on top of my first visible UIView, do my animations and then tear down my start up screen. If you want to see what I do in action, try it out with my App (The Opera Player)

iOS 7 UIImagePickerView shows black preview initially

I am trying to call in a UIImagePickerView and sometimes when my camera view (with custom overlay) shows up it gives black preview initially. And after 15-30 seconds the black screens disappears. If the image is clicked with black camera screen, it still shows up in my UIImageView.
I followed up with the following similar posts:
iOS 7 UIImagePickerController has black preview
and
iOS 7 UIImagePicker preview black screen
I tried doing both. I have managed all the UI jobs on specific background thread and the getter method fix in the second link. But it was not fixed completely either way.
Here is another similar question explaining the problem I am facing, iDevice camera shows black instead of preview
I am still confused why is this bug actually occurring? how can it be reproduced? (as it appears sometimes only) and What's the right fix for this?
I ran into this same problem with the camera preview tonight, and the root cause of the problem was … completely unrelated code in the app delegate that modified UI on a background queue.
Once I eliminated the calls to UI code from background queues, the camera preview became fast and reliable.
This article ( cocoanetics.com/2013/02/uiview-background-queue-debugging ) was very helpful in tracking down where the UI was being modified from a background queue.

UISlider is not smooth on first generation iPad

I am developing an iPad application and in my application I have used UISlider and I have tested my app in Ipad1 but it is not responding very smooth. But, the same application is responding very smooth in iPad 2nd gen.
In iPad first gen, every time I move the slider the slider value changed action is called but I'm not doing anything on that function. I am doing all my actions only on touch up inside and touch up outside. It is not working fine because it is not always called. Is there is any way to overcome this issue?
Using many UIImageView with partial transparent images or glow/shadow effects on UILabels and similar can slow down the application. It can be anything different from the UISlider which slows down the displaying of the UI.
Otherwise you have made something very CPU intensive in the observer of the UISlider.

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