IOS: Smooth launch when becoming active - ios

When my app has been inactive and I then click on it, initially it brings up the last screen it was on. Then it segues to the the entry screen.
This is a bit jarring especially because the entry screen is a New screen and if nothing is New, it, in turn, segues to yet another screen.
Is there a way to better control what happens on return to active so that it stays on the last active screen or goes straight to the entry screen without first flashing the last active screen? I imagine this may have something to do with applicationWillEnterForeground: but with no experience with this, I find Apple's documentation fairly dense going.

You want to check out state restoration, which is a way for you to implement a seamless transition to the last point the user left off. There are also great WWDC videos on it.
https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html

Related

Objective C - Detect if finger is held on screen at app startup

I'd like to perform an action when the user has their finger held on the screen when my app startups.
To give an example: When the App launches and the launch screen is showing up, the user has a finger on the screen as long as the first ViewController appears. When the first ViewController gets into the viewDidAppear() function, I want to detect, that the users finger is on the screen and perform an action, like f.ex. jumping straight into the lastest received email. Basically this is supposed to be a kind of shortcut to an main action.
Is there any method to detect an already laying finger on the screen? To be exactly I'd like to check for the tap in viewDidAppear()
Unless the nature of Time has changed since the last time I checked, your app cannot detect what the user was doing before the app launched. The app, ex hypothesi, was not running at that time. And the mere presence of a finger on the screen during app launch will not generate a touch event that the app can detect.
The system can detect it, however, since is running before your app launches. That is why Apple added force-touch Shortcuts (for appropriate hardware). The only way you can do what you're asking is to rely on that API. Hardware that lacks this feature will simply have to do without this feature.
(After all, this is how Apple makes money: by trying to make users jealous of hardware they don't have, so that they buy new hardware. You would want to rob Apple of its income by reading this feature backwards onto old hardware, even if you could, now would you?)

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 Swift Briefly Display Info

I want to have some information drop down from the top of a view, stay on the screen for a second or two, and then go back up out of the view. I have search for displaying notifications and/or banners. All I get is either push notifications (which I don't need to use) or iAds banners.
I'm working on a barcode scanning app and I want to briefly show the value of the barcode shown without requiring the user to tap on anything. How can I accomplish this?
Don't use notifications and banners, because that might not work: the user can turn them off. In any case this is not a notification of anything, so it's a misuse of notifications.
Just do what you described, yourself: animate a view onto the screen, and then (in the animation's completion handler) use delayed performance to animate the view right back off the screen after a short delay.
You should use a view which manages its own state (INCOMING, STAY PUT, OUTGOING). This way you can reduce the memory footprint and many other bugs in the process. I coded something for a similar process. Check it out

Presenting a new viewController doesn't seem to unload the previous

The game I'm developing consists of a Main Menu, and Game viewController separately.
However when moving from the game screen to the menu screen, it seems as if the class files from the previous viewController are still in effect?
For example, players start the game by tapping anywhere on the screen whilst in the game viewController, which causes a new bar to be "launched", which in turn plays a small tone which varies depending on the direction. However when returning to the main menu after the game is over (achieved by pressing a button to present the menu viewController), tapping anywhere on the menu screen seems to start the game again from the game viewController?
By this, I mean the bar launch sound is played, despite there being no code available in the main menu viewController to play said sound, pressing play on the menu will take you to the game screen, where the game has been reset, until tapping again, where the sound plays implying a new bar is launched, despite all images being invisible.
I made sure that, when leaving any view, I wipe all subviews from the view, so that whenever the screen is loaded there's nothing being covered up. I also tried dismissing the previous view controller, however nothing seems to take effect. So, I can't tell for certain whether the views are being removed or what... It's simply mind breaking to me.
Unfortunately my descriptions most likely aren't doing myself any justice, so hopefully this video demonstration will help out. Note that at the beginning, I am tapping the screen to show that no sound is played, however of course that won't be visible.
Edit: You'll notice that when returning to the menu, tapping the screen seems to mess up the moving bar in the background, despite the gameBarMovement timer being invalidated upon moving from the game to the menu. The fact that they're using separate class files also should mean the bars shouldn't be effected? Knowing me, I've missed something fairly obvious.
This is how the UIViewController life-cycle works as far as I know. UIViewcontrollers aren't unloaded until the app starts running out of memory. What you probably need is some way, in your game VC, to stop the game loop from running and resume it once a new game is started.

iOS remove view before applicationWillEnterForeground

I'm developing an app on iOS 7 with a desired feature is that
When I home button, app enter background, I will add an image to current UIWindow. So when app enter background, if user double home button on iOS 7, os will show a small screenshot of current view of my app, so user can see my added image. :) (I did it)
When user return my app by clicking app icon, I want to remove this image immediately. In this situation, "immediately" means that user can NOT see this image anymore, user just see his/her current view when app enter foreground. I try to place the code remove image on the beginning of applicationWillEnterForeground delegate, but I'm still able to see this image for a short time after it disappears.
I also try to set hidden, alpha property for this imageview first, then removeFromSuperview, but it not works.
Can anyone help me to remove it "immediately" as my desire.
That is done automatically for all applications, you don't need to do anything in you code.
I don't think that you can do it faster, it depends of device performance. Sorry man.
Like other says it is really tricky how iOS handles these events. I've been researching and depends on the memory state of the device to do it faster or not. Indeed, in iPhone 4 and 4S may not show the image that you added on applicationWillEnterForeground method.
If I were you I would solve it by adding a smooth fade out animation of that image when the app becomes active again. With [UIView animateWithDuration: animations:] it could be nicely done! :)
If I find out something else I'll answer here!

Resources