Discussion Forums  >  Xcode, Errors, Installing, Configuring

Replies: 12    Views: 230

DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
02/03/16 12:29 PM (8 years ago)

HOW TO: iOS: Best way to get rid of white loading screen

At first I posted this: "This method will allow iOS to automatically choose the correct image size, for any iOS device serviceable by your app, as of when this tutorial was written using Xcode 7.2.1." Well, CORRECTION: I discovered that this method does not automatically choose the right size. It works -- but not as I earlier misunderstood. It picks an image, I'm not sure which, and tiles that image if it is not big enough for whatever device is calling for it. 1. In the Project Navigator view, click on Images.xcassets. Screenshot: <a href="http://cac.us.com/app/images/tutorial/1.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/1.jpg</a> You may already have a LaunchImages asset. You may either use it or you will be creating another one, similar but with a different name, and it may be used. I use both (one for launch splash, another to replace white loading screen as a second splash). In the code-editing steps below, if you wish to use the existing LaunchImages asset for replacing the white loading screen, replace the words “LoadingImage” with “LaunchImages.” The rest of the instructions assume you want two splash images, one provided by Xcode by default, using LaunchImages asset, and the other provided by a BT view manager, using the LoadingImage asset you will create in the next steps. 2. Supply images of the correct size for the existing LaunchImages asset. CORRECT IMAGE SIZES Screenshot: <a href="http://cac.us.com/app/images/tutorial/2.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/2.jpg</a> They must be PNG. When you drag an image into one of the asset boxes, if it is of the wrong image size, a small yellow error message flag will appear in the upper part of the screen, and if you click it, it will alert you to what size was called for. Use the attached Finder image to get the needed sizes, as of Xcode 7.2.1. If you wish to use only one splash image skip step 3. Be aware that there will likely be a re-adjustment moment, when the Xcode built-in launch viewer (splash screen viewer) switches over to the BT loading screen view manager. The same image for both will actually look like two versions of that image as some type of “zoom” adjustment happens. If you are OK with that, skip step 3. If you would prefer to have two consecutive (and different) images instead, do step 3. 3a. In the Project Navigator view, in the Images.xcassets area, right-click, select “App Icons & Launch Image” and then choose “New iOS Launch Image.” Screenshot: <a href="http://cac.us.com/app/images/tutorial/3a.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/3a.jpg</a> 3b. Rename the new asset. By default, it will appear with the name “LaunchImages-1.” You can name it whatever, but for the steps below, name it “LoadingImage.” Screenshot: <a href="http://cac.us.com/app/images/tutorial/3b.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/3b.jpg</a> 4. Supply images of the correct size for the new LoadingImage asset. Drag each appropriate image onto each empty asset box. CORRECT IMAGE SIZES Screenshot: <a href="http://cac.us.com/app/images/tutorial/2.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/2.jpg</a> Screenshot: <a href="http://cac.us.com/app/images/tutorial/4a.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/4a.jpg</a> Screenshot: <a href="http://cac.us.com/app/images/tutorial/4b.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/4b.jpg</a> The images must be PNG. When you drag an image into one of the asset boxes, if it is of the wrong image size, a small yellow error message flag will appear in the upper part of the screen, and if you click it, it will alert you to what size was called for. Use the same attached Finder image (mentioned in step 2) to get the needed sizes, as of Xcode 7.2.1. 5. The first code edit — replaces the white loading screen with your chosen image: Screenshot: <a href="http://cac.us.com/app/images/tutorial/5.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/5.jpg</a> In the Project Navigator view, In BT_Layout, In loadConfigDataViewController.m Search for “viewDidLoad” Replace: [self.view setBackgroundColor:[UIColor whiteColor]]; With: [self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"LoadingImage"]]]; 6. The second code edit — gets rid of an annoying fade-to-white-then-fade-to-black “event” during the transition to your app’s main view manager: Screenshot: <a href="http://cac.us.com/app/images/tutorial/6.jpg" target="_blank" rel="nofollow">http://cac.us.com/app/images/tutorial/6.jpg</a> In the Project Navigator view, In BT_Config, In appDelegate.m Search for “tmpWindow setBackgroundColor” Replace: [tmpWindow setBackgroundColor:[UIColor whiteColor]]; With: [tmpWindow setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"LoadingImage"]]]; 7. Rebuild your app and test.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/03/16 01:44 PM (8 years ago)
Hi Doug, I actually use that load screen in place of a splash screen, and it works perfectly. I simply open the white images that are located in the area you specify above, modify them to my needs (keeping the same size), and save, overwriting the old white image. That works absolutely wonderfully for me, and it's about as simple as you can get. If overwriting them scares people, they can always make a copy of them first, and then just restore them later if necessary. Great tutorial! Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/03/16 01:47 PM (8 years ago)
Good points, Mark. I am so new that I need help with everything. How does one disable the default Launch (splash) that Xcode provides? (Which is based on images dragged into the LaunchImages resource.)
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/03/16 01:51 PM (8 years ago)
If you're wanting to disable a launch image completely, I'm not sure how to do that. But, I'd advise against it, as Apple view the launch screens as important to the user experience. Ideally, they're supposed to be launching part of the GUI so users feel like something is happening while all the magic happens in the background. If you want to replace them with new images, then you can do what you and I have both proposed. Either will work. Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/03/16 01:52 PM (8 years ago)
Mark, re: "I simply open the white images that are located in the area you specify above" What images are you speaking of? I did not reference any as far as I know. The package download does not seem to contain any white images, and the project seems to be programmatically assigning a white color. Thus I am not sure how to repeat the trick you mentioned here.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/03/16 01:55 PM (8 years ago)
Mark, re: "If you're wanting to disable a launch image completely, I'm not sure how to do that." I'm not sure we're on the same page. Xcode provides a default system for a built-in LaunchImage, but the app maker has to create images for it and drop them into the asset in the empty boxes. Then BT provides a white loading screen that displays after that. Thus, there are two screens in the discussion. You mentioned you were using the loading screen as your splash (i.e. launch) screen instead. "I actually use that load screen in place of a splash screen." My question is, how did you turn off the splash screen provided by Xcode, to have only one. If I am misreading you, please help me.
 
GoNorthWest
buzztouch Evangelist
Profile
Posts: 8197
Reg: Jun 24, 2011
Oro Valley, AZ
1,000,000
like
02/03/16 01:55 PM (8 years ago)
Sorry...guess I didn't read that close enough. The images that I change, and which I believe are the launch images, are located in: <Project file folder>_iOS\<project name>\Images.xcassets\LaunchImage.launchimage Once there, you'll see 13 images that you can modify. All are correctly sized and named according to Apple. Mark
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/03/16 02:19 PM (8 years ago)
Mark: Thanks for the clarification. That default LaunchImage asset, is associated with an Xcode built-in Launch screen. The BT project then has a white "loading" screen that shows up afterward. This tutorial offers a way to either display the same launch image in both viewers, or display a second image in the second, instead of the white loading screen. The small spinning "progress" animation still plays during the latter. I would like to know if and how that can be edited, but that is beyond where I am right now, knowledge wise. Thanks for the info!
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/03/16 07:47 PM (8 years ago)
If anyone knows a way to either stretch the image so it does not tile it, or how to make it actually choose the correct image from asset array I would be very interested.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/05/16 01:39 PM (8 years ago)
Have a look towards the end of this thread http://www.buzztouch.com/forum/thread.php?tid=C02498F2E8BB74B6B98EBBB My own way of dealing with this is to edit all the loading screens in xcassets with photoshop, adding the text 'Loading...' in white writing (just to show something) and to change code you referenced: [self.view setBackgroundColor:[UIColor whiteColor]]; changing the whiteColor to blackColor (to match the images in xcassets). I find the result works well enough and has no white flash, which was my aim. Cheers, Alan
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/05/16 05:01 PM (8 years ago)
Thanks, Alan, I appreciate the reply! Please note that I already had all my images created at the exact correct resolutions, and stored properly in an asset, yet I am still seeing the wrong image displayed, with tiling happening. It is passable (acceptable), but not what I am aiming for. I am currently off that issue as I am trying to decipher: (1) why push notifications are not working despite me having followed all the tutorials to the letter. (2) why switching to "live" instead of "design" is not recognized as Live by the device list in Push Notifications. These issues are currently my most pressing delays on getting published to the App Store. Thanks again for the kind reply. I really appreciate it.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
02/06/16 01:27 AM (8 years ago)
(1) and (2) are both covered in some detail in the forums, but long story short, live/dev mode appears to be broken and nobody has found a fix. Yet . On push, some people have it working, most recently @funkymonkey publicised how, but most don't. My guess it is either a geographic or hosting related. Consequently, many people use 3rd parties such as parse.com, but they have just announced their withdrawal.
 
DougJoseph
Aspiring developer
Profile
Posts: 161
Reg: Jan 30, 2016
Stonewood
2,210
like
02/06/16 05:36 AM (8 years ago)
Thanks! Very helpful info. Yes, I had seen that Parse is giving a one year sunset period and then shuttering their service.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.