I can't create a splash screen for a Flutter app, using Xcode for iOS - ios

I read lots of articles about the Splash Screen and how to create it in Flutter but almost all of them are deprecated now. Neither one worked for me, and I did try by myself, but the Splash Screen is not displaying, instead is displaying a white background.
I found out a package which could make my life easier, but I think it's better to create the Splash Screen as it is created from the official documentation.
As I understood, I opened the Runner.xcworkspace folder in Xcode. After that I uploaded 1x, 2x, 3x images which were the logo with transparent background. (I used the same size)
I didn't find the real sizes for 1x, 2x, 3x images anywhere for 2021/2022. A few people put there full images, while the others put only the logo.
I decided to change the background color from the View property as in the image below and I've fixed the image with the drag option and I am pretty sure that it's not a good approach.
So, even if I created somehow the Splash Screen, it is not rendered on the devices. I restarted the emulator, deleted the app and didn't work for me.
The question is, how to create Splash Screen for iOS in a correct way and why it is still a white background?
Edit: I managed to display the Splash Screen selecting this property in the image above, but as I expected, it is not rendered well. So the question remains: how to create Splash Screen for iOS in a correct way?
Edit 2: The logo is now centered by autoresizing arrows from Size Inspector, but after 1 second it is resizing between 1x, 2x, 3x. Also, I used 3 constraints.

Chose your logo and click here:
image
Use alignment constants and set your logo 0 horizontally and 0 vertically. (Be sure you have chosen your logo file). Click "Add 2 Constants" It will show your logo in a centre at every Apple device.

Related

image view only shows background color in launch screen

I'm having some problems with my app's launch screen storyboard.
When I run the app on an iPhone 5S, the image is displayed. However, when I run the app on an iPhone 8, the background color of the UIImageView is shown.
In the project settings, at App Icons and Launch Images, I am not using an image source (although trying do so doesn't seem to work either) and the Launch Screen File is set to LaunchScreen.
The View Controller has Is Initial View Controller checked and the file has Use as Launch Screen checked. The image set was brought in using Import... and is universal.
I've read through several of the solutions for black screen here, but switching the background color revealed that was where my black screen was coming from.
In the assets file, the image set has 1x # 640x1136, 2x # 1242x2208 & 3x # 1125x2436. I experimented with other combinations, but this is the first set that let me see the actual image on the 5S. I'm pretty sure the issue is not having the right configuration of dimensions in the image set file, but can't be certain.
Any help would be much appreciated. Thanks in advance.
Had the same thing. Working on the simulator but didn't work on the device (or any other possible option). It's just a bug.
Try these until it works:
Turn simulator/device off and then on again.
Hard clean simulator. Turn it off.
Clean/Hard Clean/Delete Derived data
Reboot Xcode
Hope one of these helps.
If not, please include the screenshots of working / non-working app screens.

My exported sketch images won't work on different screen sizes in Xcode

I designed an interface in sketch for an iOS app that I am creating and then exported the artboard as a pdf and placed it in Assets.xcassets in Xcode. I am now trying to make that image show up on the entire screen for all screen sizes. When I created the image in sketch, I used an iPhone 6 screen size (375 by 667). In Xcode now, the image takes up the whole screen on a iPhone 6 screen, but it doesn't take up the whole screen on any other device. It is too large for an iPhone 5 screen, so only part of the image is shown, and it is too small for an iPhone 6+ screen so there is white space on the screen. How do I make Xcode scale this image for all the different screen sizes? Thanks
1) First off make sure you're actually saving the asset as a vector:
It'll say Universal under and on the very right you'll notice it says Scale Factors: Single Vector
Now if You're still having issues it probably just means you haven't added constraints to the image. So it's just using the default size (the size you exported in).
If you're using storyboard or XIB make sure the image takes up the space it wants, click on it, then press on the little triangle on the bottom right of the storyboard and under Selected Views press on 'Reset to Suggested Constraints'
This should make sure the image resizes with different views. But because you might get different dimensions you'll probably want to set the UIIImageView's mode. Again on storyboard you can click on the imageView and then:
If you want the image to keep its aspect (not stretch in any direction) but want it to fill the entire space it has, put the mode on Aspect Fill

Set images for different iphones and debug

I am currently developing an ios app and the scope is limited to iPhones only and portrait mode only.
In each screen there are images, buttons, labels and textFields. The question here is, how do I render appropriate image for device from the Images.xcassets?
What I am doing now, written below -
From Sketch design application, exporting my images for 1x, 2x and 3x (Screens designed by a UI designer)
Adding them to Xcode project (drag and drop from finder to xcode)
Add new image set in Images.xcassets (naming it as "MyImages") and drag drop my images for 1x, 2x, 3x.
In the storyboard, on a viewcontroller, adding an ImageView
For the image view, selecting Image as "MyImages" from Attribute Inspector.
Once the above steps are complete, when I test the app on simulators starting from iphone4s, iphone5, iphone5s, iphone6 and so on.. (all the simulators available on Xcode 7.3), I don't see the appropriate image is being rendered.
Is my approach correct?
Also, how do I debug a UI element on the screens? Like, how/where do I check for what image is rendered? Its size (W X H)?
Added Screenshot
#Lohith Korupolu:
The screen shot you provided is for universal size (iPhone/iPad). From the additional information provided in comments, this would lead to issues with AutoLayout constraints that would stop the image showing on screens of a smaller size than that shown in your StoryBoard.
E.g. I have replicated your issue on storyboard...
This results in the following in Simulator for iPhone 4s....
i.e. Text is there but NO IMAGE.
REASON: The autoLayout Constraints set for the larger "Universal" Screen on any of two opposite sides would make the image invisible/ disappear when viewed on a smaller screen.
SOLUTION:
1. Clear the Autolayout constraints for this selected Image in Storyboard. See next picture...
2. Add AutoLayout constraints as below x2 pictures. (Top constraint, Height + Width) (horizontally in container). Remembering to tick "Items of new constraints" for both.
3. Run Simulator for iPhone 4s... E.g.
** The same situation is occuring with the other iPhone size simulator Runs. **
****** All Working ******
They should all be 2x images for iPhones apart from the plus size iPhones which should be 3x. Is that not what you are seeing?
In terms of debugging / checking this - you can put place holder images in your assets with labels or different colour tints to distinguish them from each other and then replace them later with images that give the desired final appearance once you know that everything is working as expected.
Using 2x images for iPhones approach works fine, however, there is another more straight forward way without having to resort to multiple image files for 1x, 2x, 3x in Xcode, by use of good large quality PDF (vector).
1. Create a Large PDF of the image/Graphic image you want to use
2. Import it into 'Assets.xcassets' - drag and drop (Into Xcode)
3. Go to the utilities panel on the right for the 'Attributes Inspector' (when the image is selected)
See Screen shot (a)
Under 'Scale Factors' the selection from 'Multiple' to 'Single Vector'
Now when you got to 'StoryBoard' and add the image - Simply select the PDF's name.
Xcode will automatically render it to correct size etc at run time for you. All the work is done by Xcode.
Exceptions:
It does not work well with images for icons inside the TabBar or Navigation Bar Items.
Note:
Vector graphics are sharp and ideal for High Definition (HD), but although Xcode accepts the Image Asset as a vector from the PDF, it doesn't seem to keep the vector but converts it into an actual image with pixelation problems when zoomed in, from a HD perspective.

How to force universal app on iPad into scale mode?

I created an universal iOS app. On all iPhone variants I want native resolution without scaling, so I created splash screen images for all available sizes in images.xcassets/LaunchImage.launchimage and set them all in Xcode:
Now, this works very well for all iPhone versions up to the biggest iPhone 6 Plus.
On iPad (with high pixel density) though I don't want native resolution. Instead I want it to scale the app (even if it looks a bit blurry then, but that's ok).
How would I do that?
In image assets you have to provide proper size for each launch screen, You can not use the same image for two devices in launch-images ( unless you have two copies of the same image ).
If you want to make app-size smaller, implement launch screen, set its background color to your desired background color and put your logo in the center of it. You can now remove iPhone 6,6Plus images from image assets, but you still have to provide launch images for iOS 7 devices (old iPhones / iPad ).
Don't use the Asset Catalogue. Create a LaunchScreen.xib , add a UIImage inside the view. Open the attribute inspector in the right hand panel and set the view mode to Aspect Fill.
The solution was quite easy, I simply changed project type from "universal" to "iphone" and that did the trick!

iOS - Icon Stretching on Startup

So when you want to get to an app, you have to click on the app's icon. When I do that, the icon itself stretches out to fill up the entire screen. Every icon suggestion I've read has opined that I make the icons 120X120 or some other version of a square image. I've done that, but so long as it's a square image if the app tries to make it fit into a rectangle it is going to stretch.
On top of that icon is the splash image with is rectangular and looks just fine, but I don't know how to tell it to not use the square icon behind it. Thoughts?
In case anyone comes across this for the 6+/7+ only, you need to have launch images for both portrait and landscape.
On opening the app, are you simply wanting to use the image used for your app icon to appear full screen for the splash/loading screen while it is being launched?
If this is the case, the app icon itself is not the image that will stretch, rather, you need to make a separate launch image of how you expect full screen size image to look. The app icon will display according the the image you have saved as the icon (correct HIG sizes/filenames) and then when it's loading, the app will automatically switch to display your launch image.
Please read this Apple information on Human Interface Guidelines (HIG) as it tells you what images will be needed and what to do.
I hope this helps answer you question.
Cheers, Jim.

Resources