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

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.

Related

Application walkthrough when opened for the first time

How do you setup in your application to show little bubbles with text and block the rest of the screen from being used and only allow a small section / button to be pressed. I am wanting to create a walkthrough to show users how to use the application and where to find things within the application when it is opened for the first time.
I would like to dim the rest of the application except for the part I want them to click on. Is there a framework already with these features?
There's no frameworks that provide this functionality, as far as I know.
One way you could do this though is to have a set of overlay images which you overlay over the whole screen the first time the user goes to that screen. To determine if the user has already been to a screen, I suggest you look at NSUserDefaults. To create the overlay images, I'd make the image the full size of the screen (i.e. 460x320 if you are showing the status bar) and then have transparent sections where you want to "see through" to the element below. Add a gesture recogniser to the overlaid image view to detect a tap and then hide the image and set the flag in NSUserDefaults to make it not happen the next time the user goes to that screen.
If you don't get a better answer, you could look at MAAttachedWindow on the page at this link. It's written for Cocoa, not Cocoa Touch, so you would have to convert it. I am considering doing this myself. You might find it to be worth the trouble, but I haven't looked at every detail, yet, so I couldn't say for sure. There are only tow files that are involved (.m and .h).

Retrieve data from API while launch image is shown

Is it possible to retrieve data from web service while launch image is being shown?
Or I will not show a launch image but I'll just use a view controller with an image (launch image), and retrieve data when that view controller is currently viewed?
You don't really have any control over the launch image, so the second option you listed is how you should do it.
Apple's Human Interface Guidelines suggests to "Start Instantly", not to use a launch image, but instead to show the actual interface as soon as possible, and if it's not ready yet, to show an activity indicator, etc.
The launch image is there simply because you application's delegate and main view controller are NOT yet loaded into memory. Par Apple documentation: launch images are there to look like the first view controller to give the perception that your application starts faster than it is truly is.
What this all means is that while the launch image is shown, you aren't getting anything but setup code done. The closet you could get loading something from the web on start up would be a "viewWillLoad" or "xxxWillLoad" type method. Loading an extra view controller is a waste of the user's time and (although considerably small) memory.

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. :)

How to use Sleep in the application in iphone

I have used to loading a default image in my appication. So i have set to,
Sleep(3); in my delegate.m class.
But sometimes it will take more than 6 to 7 minutes. So i want to display the image 3 seconds only and then it goes to my appilcation based on my requirements.
Which one is best way to do that?
Sleep(3) or [NSThread sleepForTimeInterval:3.0] or something else;
And i must display the image 3 seconds only. Please explain me.
(Note: And I declared setter and getter methods only in my deleagte class.)
Please explain me.
As Rob noted, Apple strongly recommends against a splash screen unless it hides some necessary behind the scenes process (like loading game graphics.) It is so strongly discouraged that some people have claimed that their apps have been rejected for using an unnecessary splash screen.
The default.png doesn't exist to create a splash screen. Instead it exist to allow you to create the illusion that your initial view loads faster than it does. You supposed to use it to provide an image of your initial view so that the enduser can begin to cognitively orient themselves to the interface. By the time they have oriented themselves to the interface and moved their finger to touch the interface, it is live.
Why? Because iPhone apps are supposed be quick in, quick out. People don't sit down to use them at a desk like a desktop. People use then on the go. Sometimes they use them in the middle of a conversation.
I tell my clients to test out the usability of their apps (except for games) while walking, riding an exercise bike etc as well as in the middle of a face-to-face and phone conversation. In those circumstances, a three second pause is a big deal and very noticeable especially if the app is a practical app. Imagine if every time you opened the Contact app you had to pause three seconds to see an Apple splash screen. You would get peeved in a hurry.
The key thing here is that an unnecessary splash screen doesn't add any value for the user. It is a selfish act on the part of the software publisher to eat the end users time so that the publisher can build brand recognition for the sole benefit of the publisher. Wasting three seconds of the users time every time they use the app adds up in a hurry. (In my experience, it also makes the user perceive that the overall app is slow and clunky.)
However, if you do want to shoot yourself in the foot or if you have a client hell bent on a splash screen, you do it like this:
The splash screen appears until the first view loads so you delay the loading of the first view. In the app delegates applicationDidFinishLaunching: method, remove all the code that loads the first view into the window. Replace it with a NSTimer. Put the code to load the first view in the timer's fire method.
With that setup the app will display the default.png as it launches, when it gets to applicationDidFinishLaunching:it will appear to pause from the end users perspective because no view will appear to replace the default.png.
You should note that the standard launch time for an app is 3-5 seconds. So you may not have to do anything to show the splash screen for 3 seconds. It might happen automatically.
Apple strictly recommends against this (using sleep in this way), especially in the scenario of showing a splash screen.
The best thing to do is create a view that looks like your Default.png file, then have that be the first NIB.. you could then set an NSTimer to transition (with animation if you want) to your main view/window/controller.

How i calculate loading time of a application in 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.