Retrieve data from API while launch image is shown - iphone

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.

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

How to make UIWebView not act like a browser on the iPhone

My app loads webpages off the internet using a UIWebView. However I'd like to modify the experience so the user won't perceive it to be a webpage. What are some of the things I can do? and how to do it?
examples:
- Show the page when everything is loaded?
- Fade in effect?
Suggestions please.
It is possible to monitor the delegate callbacks from UIWebView to determine when the page has finished loading, and then perform whatever visual effect you want at that time. If the web view is most or all of your view controller, you could defer pushing your view controller until that time, or you could fade in the view as you mentioned.
However, even when reading HTML from the local disk, there is a noticeable lag. Waiting for remote content to load will have even more latency. You also must deal with the realities of an unreliable network: sometimes, your content will never arrive.
Once the first page is loaded and displayed, though, your options will be limited. If you try to make it appear that it is a fully native application, it's going to be hard to explain the latency or why it doesn't run when the network is unavailable (airplane mode, no cell or Wi-Fi).
I assume you are wanting to display the page as if it is a resource contained within your app (and not something streaming from a browser?)
In this case, download the webpage to a local file and display it only once fully downloaded.
I provide sample code in this answer that you can easilyy adapt for a html page (rather than a pdf document)

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.

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.