How i calculate loading time of a application in iPhone? - iphone

I want to add a loading bar at the initial of the game which is customized loading bar.
for that i need to calculate the loading percentage to show loading progress. Is there any way to calculate the loading time of the application? please help me.
If i add Default.png in my resources folder, it will seen at the time of application loading. How it works? I want to customize it.

You can change the Default.png to your liking and even exchange it between application starts, but it's still a static image that cannot be animated. It's displayed while the iPhone OS is bootstrapping your application. Once the application enters your own main function, you can display whatever you want - from this point on, what's loaded and what's displayed is under your control.
Regarding progress display, I can only speak from a game developers point of view. Normally, you know how many resources you're loading (textures, sound files,...) so you can load e.g. one resource per main-loop pass and display the progress accordingly.

I think your progress bar needs to be based on progress and not time. Remember that some hardware is faster than others. The 2G iPod touch is the fastest with (I think) the original iPhone the slowest.
Your Default.png image is entirely static. Sounds like you'd take a screenshot of your loading screen when it has zero progress and use that.

Related

How to extend the time displaying the launch picture of an iPhone app?

I have added a Default.png picture to my resource folder and the picture is now correctly displayed when the app is launched. But right now I have a problem that the time of the picture shown on screen is just too short and user just doesn't have enough time to take a look at the pic. And idea? Thanks
Make a viewController with an imageView containing the launch image. Then have that viewController load first, and set it to change after some fixed amount of time.
You could load the image onto the screen in the applicationDidFinishLaunching:withOptions method and then trigger a delay (using performSelector:afterDelay) to remove that image after a certain amount of time. That doesn't help you have a consistent load screen time, since the actual load time will vary per device, but it does let you pad the load time a bit.
I suppose if you want to get really fancy, you could pad the load time varying amounts depending on the device. Whatever you do I'd keep it to only an extra second or two.
Maybe you should take a look at Apples description, what the launch image is exactly for. I strongly recommend not to annoy the user with longer than needed "splash screens". Keep in mind, that there are people with devices, which don't support multi tasking. Using your app while getting text messages or other push notifications, switching to another app and back to yours is frustrating big time, if they have to wait until you think, they have payed enough attention to a (mostly) useless image.
Please, think about avoiding the use of nag screens. :)

Change loading image?

I want to have my loading image be different each time i start the app. Is there a way to change this to something else once the app's started?
Not technically, no. The startup images are located inside the application bundle - as part of iOS's sandboxing, applications can't change or modify files inside that bundle (so your Info.plist and your background images).
It would be possible to have your startup image be black, and then swap it out for another splash screen that you hold for a few seconds as soon as your applicationDidFinishLoading method is called - but remember this will degrade the user experience, since you'll be delaying the time it takes to get into the app.

iPhone App Startup Screen

yet another basic question ... I have an app that takes about 4-5 secs to load.
I want to use the time and show a startup screen that
is visible at least for 4 seconds, and
shows until the app is loaded and ready to show
How can I build that into my app?
Default.png is just the starting point. That will give you a splash screen (the Apple user interface guidelines suggest that the splash screen should look like the first screen to make the app look as if its loading faster - but that's actually a bad user experience IMHO).
The splash screen disappears as soon as the first view is shown. However, if your code is still doing stuff that renders the interface unusable, it can be worthwhile to make your first view look like the splash screen, possibly adding a progress bar, then swap that out for the first real view when your app is actually ready for user input.
Looks like a job for Default.png
http://iosdevelopertips.com/cocoa/defaultpng-the-secret-of-the-load-screen.html
Don't forget to be careful of your capitalization.
Have your application start with a view that shows the initialization progress and after the initialization is complete, replace it with your app's main view. Make sure to defer the initialization step with -performSelector:afterDelay or place the initialization code in -applicationDidFinishLaunching, so that the Default.png doesn't show up but for a very small amount of time and you can show your progress view.
Refer to this StackOverflow question. However, if your app takes 4-5 seconds to load, I would focus on improving its performance. Can you do some operations later, rather than at startup? Splash screens are generally a bad user experience and are discouraged in the Apple Human Interface Guidelines.

Good ways to dynamically generate the start image of an iPhone/iPad app

I'm self-learning iPhone development and I see that one of the aspects of an iPhone/iPad app is the start image that gets displayed when your app is run. I'd like my start image to display some basic info about the user when the app is launched, but that info has to first be collected by the user when the app is first run. That tells me that I either need to dynamically generate the start image after the user enters their information or I need to place a label of some sort on top of my static start image in order to accomplish this. The first time the app launched and before the user enters their info, the start image can be anything or nothing at all, I'm not concerned about this.
So, my questions are...
Can you place controls, like a label, on top of the start image when your app is launched?
If not, what's a good approach to dynamically generating the start image after the app is launched for the first time and the user info is collected?
If there's no way to change this start image (thanks kristopher!), can I instead display my dynamically generated image for a set amount of time (~3 seconds) as soon as the start image closes? Do I even have to use a start image at all?
Thanks so much in advance for your help! I'm going to begin researching this question right now.
To answer number 3, Yes, you need a start image. It should look like your dynamic start image but without the dynamic information.
To display the dynamic information briefly after launch, just use a modal view controller on top of whatever view controller comes up first (called viewController below):
SplashScreenController *splashScreen = [[SplashScreenController alloc] initWithNibName:#"SplashScreenController" bundle:nil];
[viewController presentModalViewController splashScreenController animated:NO];
[splashScreenController release];
[viewController performSelector:#selector(dismissModalViewControllerAnimated:) withObject:YES afterDelay:3];
Obviously you need to create a UIViewController subclass and xib file called SplashScreenController.
Apps can't change their start images. Those image files, as well as other files in the app's bundle, are treated as read-only by the OS.
If you don't have a startup image, then the user will just see a black screen for a second or two (or more, depending on how big your app is). It's a good idea to have a startup image.
You can display whatever you want after your app starts running.
I do something similar to what you are trying to accomplish, except I do not display user information. If you want to see what I did, check out my app How Long Can You Tap It (free). The Very first image, as Kristopher mentioned, is not changeable. It will be displayed for as long as the application takes to load. Then, the image will disappear and show your initial viewController, which will be whatever you want. In my app, it simply is the same image is the initial image, but instead of saying LOADING I display text telling you to Tap the screen to start playing. If you don't want to rely on the user to tap the screen to continue, you can do what Frank said and dismiss it within X number of seconds. If you want more code than what Frank provided, let us know.

iPhone Animated Loading Screen

Is there a way to have an animated loading screen for my iPhone application as opposed to the Default.png that I currently am using?
In short - no. The purpose of the Default.png is to give the iPhone OS something to display to the user while it loads your application in. The best you can do is to speed up the initial load of your application (say defer your resource loading until after the program is running), then add your own animation while you actually load your resources 'behind the scenes'.
If you think of it as an animated loading screen then no, but having the first view of you application load all the data and do something while it is doing that then surely yes, but I am trying to do that and am failing at the moment
As far as I know, unfortunately not. The point of the lightness of default.png is to allow the app to do intensive ramp-up behind the scenes. Animation would eat precious CPU cycles.
However, if you need to do more processing once your app has launched - you could do a threaded CAnimation during this time.
no, but if your initialization take lengthy time.
you can add an customized animating launching view once the application is launched.
for short.
after launched, before all the real initialization, alloc, init and display a view which is exactly the same as default.png but with animating effect.
while that animating view is displaying, init the real stuffs of your application in background
replace the animating view while done
You can do what one of the app which I know does. They have created series of images, which when displayed in sequence will make one believe that the splash screen is animating. You can check this app to get an idea: TravellerID
Hope this helps.