iPhone - Objective C, on app launch image - iphone

I'm using the Utility Application template to build my app.
Having a hard time getting an image to show up as the app launch. (I'm having this difficulty with all the templates basically)
Basically, right now when the app launch, it starts with a black background and it takes a second or 2 before the content appears.
However, I see that some apps has an image as it opens up. How do they do that?
I tried adding it to the "UIWindow" and have it set to "visible at launch". It doesn't quite work as expected. (i.e I think it goes behind the views since it is visible only when the views are flipping)
Thank you,
Tee

You need to add Default.png image to your resources directory. That should do the trick.

Related

Launch image can't be deleted from Xcode project

I added a launch image to my iPhone app in Xcode, but after while, I realized that it wasn't the right image, so I deleted it , but the problem, the image is still showing up on the app.
I have tried building and cleaning from scratch but still no luck .
Any help would be appreciated.
#TheEighthEro:
SOLUTION:
Considering that you have properly deleted the Default.png
In this Target Settings , go to Copy Bundle Resources. Remove the Default.png from there too.
Clean and Rebuild and Run the app. I am sure it won't show up then.
I think that should work for you.
Also try refering to following links:
can't remove splash screen image in iOS Simulator
http://www.iphonedevsdk.com/forum/iphone-sdk-development/81470-cant-remove-splashscreen.html
Hope this helps.
Did you remove the reference to the image in your app's info PLIST and/or the project build properties? Did you delete the image from the filesystem or just delete the reference in XCode? I would check both those things and then do a clean build.
Good Luck.
I was founded another reason to have it. If u disable to use asset catalog for launch images, but keep images inside image set, Xcode anyway using images from image set (definitely bug in Xcode). After removing, clean and removing app from a device/simulator, problem is gone.
That’s not possible. Every iOS app have a launch image, which you can change. The shorter your app takes to load, the shorter you’ll see that image. There is absolutely no way around this, since it’s something Apple specifically did to ensure that the user is never left with a black screen (that’s somewhere in the documentation I think).
If you want an animation, change your first scene to a scene with that animation, which redirects to your home scene after the animation is done. You can make your user think the launch image is part of the animation by having your first animation frame be the same as that image. That’s how most games do (Infinity Blade for example).
Link: http://discuss.cocos2d-x.org/t/custom-launch-image-solved/6055/5

In simulator, app is blank (white), but appears normal when quit?

So I'm new to programming but I'm managed to create the groundwork for an iPhone app.
Problem is, when I run it on the iPhone simulator, it first shows up as a white/blank screen (with the status bar at the top) until I hit the home button. When it is doing the minimization animation (~0.5 second) the app will display correctly.
I know that an issue with versions could be the cause of this but I'd need to buy a newer Mac to upgrade to the latest version of Xcode. If there are other issues that could be causing this I'd love to know
thanks :)
Add Default.png image to your application and see if it shows that during loading. Run the app in debugger and add a breakpoint to viewDidAppear in your viewController. It's probably running but not loading in the view you are expecting it to for some reason.
To some viewcontroller's view your are not setting the background color as clear color .. that's why it is showing blank white screen when your application is launching .. if your are using xib .. set the background color of that view to clear color using interface builder.

how to change the background of an iphone app when it launches?

Everything is in the title but I have to make myself clear :
I don't mean : how to automatically change the background of the app once it has finished launching.
What I mean is : when you first launch the app, before the first view is loaded by the iphone there is a black screen. Is it possible to change this black screen which I get when waiting for the first view to appear? I'd like to put a picture instead.
Thanks!
John
You need to set a Default.png and a Default#2x.png (for retina) and all the work is done for you. Or if you have payed to be a developer, download xcode 4 gm, and you can double click on the loading screen area and you can have it named what ever you wanted.
Just add a picture called "Default.png" to the project (size of the iPhone screen) and it'll automatically appear.
You can add Default.png and it's variations to your project. This image will be displayed as splash screen during application startup (before the first view is loaded).
Search for Application Launch Images at ...
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/BuildTimeConfiguration/BuildTimeConfiguration.html
You must specify Launch image
http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html%23//apple_ref/doc/uid/TP40009252-SW9
The docs here explain the different types of launch images can should use:
http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/BuildTimeConfiguration/BuildTimeConfiguration.html#//apple_ref/doc/uid/TP40007072-CH7-SW12

iPhone - Do something while displaying splash screen

ok. I know how to display the splash screen on iPhone. Seems quite simple enough (i.e. setting the Default.png and calling "sleep" command).
But, is the application actually doing anything during this time? My app needs to go and fetch some data from Web before showing the app's first screen, but when I do the splash screen, it doesn't seem like it's doing this while showing the splash image.
Can I actaully make the app do something while showing the splash screen?
The best way would be to structure you application differently slightly differently.
Make your application display the Default.png when it starts it (ie. put a UIImageView onto screen), then start fetching your data.
Then either when you have fetched the data (or if you really must, once an NSTimer has expired, but it's a better user experience if you avoid a fixed time interval) change the view to be your real one.
Where you have got the idea that you need to call "sleep" while showing Default.png and there is nothing going on while this image is shown? Default.png is shown when OS is loading your app. You can not do anything during this time. In fact you have not got any control yet. It is handled by the OS. The idea behind this is to give user a feeling that app has loaded quickly, but actually your app is not completely loaded while Default.png is showing instead of a black screen by the OS.
You can manually add a view looking like your splashscreen after starting your app and handle the work in background. I would also add a hint to the user which indicates "loading data", because an app should start within 3 seconds.
If you read the Human Interface Guidlines, they're pretty clear that Default.png isn't intended to be a branding splash screen. It's meant to bring up a static "shell" of the initial page of UI so that the user experiences quick loading. So it's not at all designed or intended for what a lot of apps are using it for (including some of mine).
If you have your first screen that comes up be that image again, maybe with an activity spinner or status text on it, you can do whatever you need to do in the background of it, and then replace it with the first "real" screen of your app when you're done.
Generally all of the awakeFromNib calls in view controllers are done while the app is loading (ie has the splash screen up). When I put breakpoints in my apps at awakeFromNib calls, the breakpoints are hit when the splashscreen is up and the app is loading. So everything you do in
those calls will be processed while the loading screen is up.

iPhone Splash: "Default.png" displays on simulator but not the iPhone

I'm trying to give my iPhone a splash screen.
I've placed Default.png in my resources group. When I run the simulator it is displayed as expected, however when I install my application to the iPhone, no splash screen is displayed.
Does anyone know what the cause/solution to this problem is?
Thanks!
If Default.png is not showing up in device, but simulator... then try the following.
Be sure you delete any "default.png", "Default.png", "Default.PNG", etc. that you might have created in several wrong attemps from within XCode and in Finder.
Delete the App on your iPhone/iPod/iPad
In Xcode Build->Clean All Targets
In Finder go to your project and locate the build folder, delete all folders in there.
Create a new Default.png like in the following example:
Connect iPhone/iPod to Mac.
Start your App on iPhone
In XCode launch Organizer (Window->Organizer)
Select your connected Device
You should see a tab "Screenshots"
Push the Capture Button, to make a Screenshot of your App
Push "As Default Image..." Button (This will create the Default.png and add it to your project, so that's a really handy thing)
Build and Run again. It should work now
Problems can occur due to wrong format (should be 320 width and 480 height (yes, that means you can see the status bar in your default.png)) or because you might have named the first file default.png (WHICH IS WRONG), which worked in simulator because it seems to be case insensitive but then when it gets copied to iPhone, it won't be found, cause it is case sensitive. So it will still be there in build folder (i think) causing a next correctly named Default.png not to override the old default.png in this iPhone build folder and so it might seem, that you can't fix the problem (cause you see Default.png in project, but in build it's still default.png).
At least this is my understanding now (afterwards), since for me it simply didn't want to work even though I tried again and again with different solutions from other people.
So from my point of view this different file handling (case/not case sensitive) is a mess that you can solve, by simply cleaning all and everything and trying to generate a new Default.png with the organizer (after everything was cleaned).
If you want a different/modified splash screen. Open the generated Default.png with photoshop/gimp/whatever and edit it.
Make sure your image is 480x320 pixels, and placed in your application at the top level. The frameworks will display this image until your initial view has loaded and is ready for display.
If you are seeing a black background then there is something amiss, however if you are just seeing your app's initial view then be happy you have managed to launch your app and have it ready for use in good time.
If you really, really want the user to to see your splash screen then slow down your launch by adding a delay into your app before you present the initial view
The file name must be Default.png (with a capital D). Also, do a clean/rebuild of the entire project to ensure the most recent version of the file is being included in the project. Check the filename on the filesystem, it may display differently in XCode.
Make sure that is is added into the bundle. To do this, select the image in the XCode left navigation panel, get info on the file, and make sure the checkbox for your target is enabled. Also make sure the file is really a png and not just named that way.
Just check the spelling ... I think u r using "default.png" instead of "Default.png". just make "d" capital "D" of Default.png .
Another possible issue that is Default.png is actually Default.jpg that was renamed to .png.
This will work fine on the simulator, but won't work on the device.
If you are using an iphone 4 you also need to add a
Default#2x.png with the size 640*960 px.
That's what fixed it for me.
This naming convention applies to all images in your app btw.
I had a similar problem, but my images were being displayed as gray or gray bars. It turned out that there was an alpha channel on the PNG images that the simulator was having no problem with, but the iphone wouldn't display. I opened the images in preview on my Mac and re-saved them without the alpha channel and everything worked. Don't know if this is your problem, but it might be worth a try.
I know this is old, but I'm having the exact same issue. The image doesn't show on the device, but is fine on the simulator. I noticed a lot of really weird things with my project, like there were 3-4 "Default.png" images in my plist and that there were a few other "Default.png" images in different libraries and stuff that I didn't notice.
I tried everything to get them to show up, but after creating a new project and setting the launch images to the EXACT same images I was trying to use, they worked fine. The only thing I can think is that somewhere the project gets corrupted and won't figure out what those launch images do.
Had the same problem caused by saving the initial file as default.png, so it should be Default.png (normal) and Default#2x.png (retina) images.
Go to your projects plist and add a row "Launch image" - use a different file name. Save your images with this name (and add #2x.png for retina). Should be fine afterwards.
Also, if you've already install the app on device, delete the app from device (as previous installation may not affect the changes).