Why my iPhone app has a delayed loading? - iphone

I noticed some iPhone apps give you the title screen instantly.
Then there are some apps that gives you a black/blank screen for a brief moment.
I have the latter issue, but its lasting about 2 seconds.
I would like to display a PNG image (over 200 KB size) and a loading indicator view.
My app is based on UIView. The specified a custom UIView that basically loads and renders the said image as the wallpaper.
I tried not loading this image, yet im still getting a 2 second delay time to load.
The app delegate basically sets the view controller's view as a subview.
This delay is only seen on the device, not on the simulator.
What am i over-seeing?

If you place a Default.png file in your mainbundle, it gets displayed at launch time between the time that the app is tapped on till the time that you replace it with another view.
The reason you don't see it in the simulator is because it is faster at loading your app.
If you want to display a progress indicator, you will only be able to do it once the appDidFinishLaunching is called, but the delay that you are seeing is still there.
One trick I use is to have the same Default.png displayed again in appDidFinishLaunching and then draw a progress bar on top of that. Sure there is still the static display during the initial delay, but from there until all my initial views are loaded, I display a progress bar.
There have been some recent discussions about this on StackOverflow that you should see. And see this: How To Make Your iPhone App Launch Faster

Related

skip button on splash screen inxcode

I have a splash screen that fades out and then the main view fades in.
The splash remains for a period of five seconds.
How can i skip this with a skip button with the same dynamic of fading out and then fading in to the main view.
If you can skip it, don't put it in in the first place.
Launch images are not designed for splash screens. They are there to give the illusion of faster loading applications. Apple's Human Interface Guidelines specifically tell you not to do this:
Avoid displaying an About window or a splash screen. In general, try to avoid providing any type of startup experience that prevents people from using your application immediately.
Avoid using your launch image as an opportunity to provide:
An “application entry experience,” such as a splash screen
An About window
Branding elements, unless they are a static part of your application’s first screen
Because users are likely to switch among applications frequently, you should make every effort to cut launch time to a minimum, and you should design a launch image that downplays the experience rather than drawing attention to it.
You are specifically required to follow the HIG by the App Store review guidelines and your application may be rejected for breaking any of the rules within it.
#Jim is correct although if you still want a skip button on your splash screen, you could create a new view controller and view and call it rootViewController and in the App Delegate specify that the app should open to rootViewController. In rootViewController, you can have a UIImageView with the splash screen image and a "skip" UIButton that transitions to the main view immediately. Hope this helps.

How to hide window screen and show screen after a time interval in iPhone?

I have a problem that in my app i don't want to show any type of screen and when application install on device but after 2 minutes i want to show a screen. I am using following code for this
-(void)applicationDidFinishLaunching:(UIApplication *)application{
// after 30 seconds it will show a view
[self performSelector:#selector(show_view) withObject:nil afterDelay:30];
[self.window makeKeyAndVisible];
}
But when i run app on device then it show a black screen for a moment and then show a white screen. And after 30 second of white screen it add new view on current window.
But i want that when it install on device then it will start a thread in background immediately and direct show last view. Don't show any other view or screen.
How to apply that in application?
Thanks in advance...
If you looking when the application is loading that time we can't handle that moment for that you need to use the one image put that place called the splash screen.
You need to just one image which size is into iPhone is 320*460 image and give the name of the images is "Default.png". and put into resource folder.
That's better solution for that.
There is no way to achieve this. When you start an application, it is shown immediately to the user. The white screen that you see is the window, which is the first view. Even if you leave "[self.window makeKeyAndVisible]" out you will still see a black screen.
You might now think about closing down your app programmatically right after the start and automatically relaunch it 30 seconds later, but both is also not possible.

What can I do to make an image appear before my app launch?

I´m doing an app for iPhone in objective-c, and before my app launches I want a splash screen to appear.
Thanks!
I think you are looking for Application Launch Images.
You just need to rename any image you want to "Default.png" and just add it in your project. That's all. Application will display that image while your app is loading.
As veredesmaralad answered, you can use an application launch image, but it's not really intended for use as a splash screen. It's intended to give the user immediate feedback that the app is launching, yet give the app some time to initialize. This image is displayed by the OS until your app puts its window on screen. The display time will vary from device to device.
If I were trying to do something more involved such as displaying the splash screen for a longer time, or animating the splash screen, I would display a view for the splash screen, then move on to the main app. I might just have my main UIViewController show the view, and then have an NSTimer tell the controller when to replace the view with the next view (e.g. the main user interface). For a more involved animated splash screen I might use a dedicated UIViewController to run that animation. Then when the animation completes I'd have the splash screen's controller load the next controller.
First off, this is called a "splash screen" and you may want to read up about it from somewhere like Wikipedia.
The answer to this question will depend heavily on what programming language you're using. If you could provide better explanation, a better answer can be given.

iPhone, I need to DB refresh func for a few seconds, how can I show progress before a table screen from tab selection?

I'm developing an app which has a tab bar and a UITableView, sometimes I'll need to run a function to update the database, which takes a few seconds. However, this is only needed if they want to look at a certain screen (and the data need updating) which has a UITableView on it.
I want some advice as to how, what, when and where I should show a progress indicator.
I'm thinking that I'll need something which pops up when the table view is about to be shown ?
As I say I don't know what to use to show the progress?
Also where would it be shown, would I need a new screen which is shown before the the table view or can I use and action sheet which will be dismissed automatically ?
Would like some sample code too.
There are many options for what. You can use a UIActivityIndicator (the spinning circle) or a Progress View (thermometer style) or a UILabel with the text xx% or nothing at all. If you're connecting to the Internet to get data, you should also call [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES] to show the spinning circle in the status bar.
Where is entirely up to you. Apple's own apps have put it into toolbars (c.f. EMail), in the middle of an otherwise blank view (c.f. App Store), or in a single UITableViewCell (c.f., Settings. It shows "Loading applications..." at the bottom when the app first starts while loading Settings.bundle from all installed apps.)
How largely depends on the where and what chosen, but in all cases your DB update needs to be in a background thread so you minimize the effect on the UI. If you're using a Progress View or some numerical feedback you'll want to periodically call something like:
[myViewController performSelectorOnMainThread:#selector(updateProgress:) withObject:[NSNumber numberWithFloat:(1.0 * currentRecord / totalRecords)] waitUntilDone:NO]

UIScrollView app crashing in Device but running perfect in simulator

I am working on a photo gallery app. Root view is a navigation controller which takes the user to the thumbnail view. Tapping any thumbnail takes the user to PhotoView which shows the tapped image in full screen.
Below is what I have done in my PhotoViewController:
The approach is pretty much similar to the ScrollingMadness project which I found at github.
I initialize a UIScrollView and add it as a subView to my view controller's view. Set some basic properties of UIScrollView.
Add images to UIImageViews (5 in numbers).
Add all these imageViews as a subview to UIScrollView.
When zoom operation is performed on any image, all the image subviews but the current one are removed from the scroll view.
When the image zooms out back to the minimum scale, all the images are added back to the UIScrollView.
As explained in the sample code from Apple, I am using TapDetectingImageView delegate to create the imageViews and handling touch events.
When I run the app, everything works fine in simulator. No issues whatsoever. But when I run the app in device, it crashes after I scroll to 3rd or 4th image. While debugging I found out that didReceiveMemory warning is called after I scroll to 3rd or 4th image.
I run the app using Instruments. The object allocations shows allocation levels to only 1.5-2MB when the crash happens. I believe memory usage to this level is very normal ... right?
Anyone who experienced this before OR any input as to how I can get rid of it... would be all the help I need in world at this time.
Let me know in case you need any other info.
PS > Its frustrating to see the whole app perfect in simulator but crashing in the device :(
It is crashing because its running out of memory, one thing you should check is the size of the pictures, are you picking the image from the photo library w/o editing, sometimes this will give u images of resolution of 1600x1400 which will pretty much just crash the phone because it runs out of memory, for this you should just resize your images to smaller ones. Another problem that could be causing it is you are loading too many images at once (i dont think so though), if you are using t he scroll view to have a scrolling similar to the photo application on the Iphone then you should only need to load 3 images at a time. Also maybe you arent r eleasing the images properly when you are zooming . I dont know if you a re trying to accomplish a similar functionality to the scrolling of pictures in the photo app on iphone, if you are look at the sample project PageControl, they illustrate that pretty well there.