IOS: turn off camera - ios

In my app I use iphone camera, but the process is very low when I open it; then I want to start the process when I shows a splashscreen.
The problem is that when splashscreen ends I don't want to show camera.
Then while I show splashscreen I want to start process of camera and quit it before splashscreen disappear. Is it possible?

First up, Apple specifically advise against using splash screens in their Human Interface Guidelines document. I don't know if your app would get rejected for it, but best not to try.
Second, it sounds like you need to optimise the startup of your application and probably the first view controller. To do this, you need to put off loading/initialising everything you can until it's actually needed (known as "lazy initialisation). All code in applicationDidFinishLaunching: in your app delegate and your view controller's init method, loadView, viewDidLoad, viewWillAppear, viewDidAppear should be reviewed for stuff that could be done later.

Related

Launch Screen only showing once

I have used the LaunchScreen.storyboard file in my swift file to create a launch screen, however I only see the launch screen when I load the app onto my phone. After that, even when I kill the app I don't see the launchscreen again. I want it so that it shows every time the app is booted, so after it's been removed from the background like most other apps that exist. I there a setting that i need to toggle, or am I doing something wrong?
What you want can be achieved from the initial ViewController instead of Launch Screen.
Reason: Launch Screen timing is not fixed and can have a very short appearance if the app has recently been in the memory.
I would recommend you to use the welcome graphic/animation on the initial View Controller and move to the intended View Controller after a set timer by using a segue.
Edit: Additionally, in case of a graphic, you can put that on the Launch screen as well, then on the initial View Controller. That will get you continuity.
Hope this helps.

iOS app Killed and relaunched Showing my last VC

Killing and relaunching iOS app, If I have View Controller A,B,C last visible View Controller was C. So now when I relaunch app i see View Controller C for 10 sec and then shows up Splash Screen. How can I avoid this.
Because of this first 10 sec User cant perform any event on app.
I think this is an operation system bug. But if you want to avoid this, you can try to add a splash screen image view before your app will go to background. You need to add your custom overlay view as subview to current window. Use this method to implement this feature: applicationDidEnterBackground. You can find more information about this feature here:
Display a view or splash screen before applicationDidEnterBackground (to avoid active view screenshot)
To force iOS to launch an app with its default viewcontroller or launch image, you need to call
UIApplication.shared.ignoreSnapshotOnNextApplicationLaunch()
where you implement state preservation.
Form the documentation : Documentation
Prevents the app from using the recent snapshot image during the next launch cycle.

Starts with specific scene when App launch from background iOS

I wonder how to launch the App from background with specific scene instead of always starts with launch screen or main.storyboard's initial ViewController.
For Example, if the user was viewing the profile scene and then make the app go to background from there, I would like to launch the same profile scene(without reloading or the profile pictures, bio, etc) the next time the user bring the app to the foreground.
Now the case is that the App always start with the launch screen and or the information that was loaded before went away.
How can I remember the specific scene when App enters background? By the way, I noticed this issue when I refractored the storyboard.
That's exactly what state restoration is for!
State restoration is a feature in iOS that lets a user return to their app in the exact state in which they left it – regardless of what’s happened behind the scenes.
You can enable it from your appDelegate by overriding application:shouldSaveApplicationState: and application:shouldRestoreApplicationState:
and having them returning true.
Then you will have to apply restorationIdentifier to your viewControllers (and yes, you can do it from the storyboard :) ). Doing so will allow your user to come back to the very screen / screen hierarchy they were when they last left...
You will however have to handle the logic the the data that need be displayed. In your viewController subclass, you can override encodeRestorableStateWithCoder: and decodeRestorableStateWithCoder: to store and then retrieve your data to display from the coder.
find the Apple doc here : https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/PreservingandRestoringState.html
And a Ray Wenderlich (love the man!) here : https://www.raywenderlich.com/117471/state-restoration-tutorial

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 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