I am 2 days into iOS app development, I am quite new. The very first thing I wanted to implement in my app is a Launch Screen using Storyboards (I heard there are other ways but I found this the easier). I have a vector-based PDF file (image) because I wanted to implement a gradient background without a loss in quality that supports all device resolutions.
I created an Image View in the Interface-Builder (IB) but it does not automatically stretch vertically and horizontally to fill the device length.
I simulate my results on an iPhone 14, only thin white margins appear, but on a large iPad, the majority of the screen is white. It's like as if the the image resolution is fixed across all devices.
No matter what resizing I try, I can't get it to work.
I come from an Android app development background so something like this is very easy to implement (we have fill_parent / match_parent to stress the view to its containing parent view dimensions). Is such a behavior possible on iOS ?
You have to apply constraint on the image in launch screen.
Related
would appreciate some advice. I have an app with a UIView, which contains a CALayer with animation.
Using constraints, I resize the UIView for Ipad with a bigger width and height. I noticed in simulator that the correct size would not apply unless I had the appropriate device active on storyboard. I assumed this would not be an issue in production, but now the app is published, I find that if the user firstly downloads the app on the Iphone, then when they open the app on Ipad the UIView has not resized to the larger view. I assume the opposite will be true if the app is first downloaded onto the Ipad, ie., the larger UView will appear on the Iphone.
I suspect I'm making a simple mistake here, but any opinion as to where the issue might lay would be much appreciated.
Thanks
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!
It's my understanding that apps for iOS 8 should have a storyboard file as launch screen rather than an image. I've created a really simple launch screen file that has any width and any height, and has one label of plain text reading "placeholder" and set it as my launch screen. However, when I try to run my app on the iPhone 6 and 6 Plus simulators, there's black bars around the background and the buttons on the main menu are out of place. The problem doesn't seem to be present in the 5s or iPad. Most of my assets aren't optimized for the 6 and 6 Plus though, since they were created before they came out. Is that why this is happening? Or is it something else? Thanks in advance.
Edit: Apparently, putting in a launch screen stops the app from automatically scaling. Is there a way to have both a launch screen, and keep the app scaling? Or do I need to make new assets?
This is a bit of an old question, and I ended up using a launch image instead of a launch screen, but you can probably solve this by using constraints. If you set top, bottom, leading, and/or trailing constraints on an item in the view, it'll scale itself to fit those constraints (if possible). For text, it has the autoshrink property which you can change to minimum font scale (instead of fixed font size), though I'm not sure how you can scale text up. The autolayout documentation is here.
To create a launch screen from a xib file first create a new file from under “User Interface” and select the option called “Launch Screen”
Using autolayout, design the first view of you app so it scales to suit all resolutions that your app supports.
Using the new Launch Screen
Under the app setting select the newly created Launch Screen from the app options.
This is the example for using a xib file. It can also be done using storyboard as shown in Ole Begemann blog
I'm coding a remote control with a background (designed in Photoshop) already for the iPhone 6+ with the proper resolution, which I use with an UIImageView at full size.
I disabled Autolayout/Size Classes and set the size to Inferred. Further I uploaded all relevant LaunchImages for proper scaling.
The UIImageView scales properly for all screen sizes, but the buttons I put over the background are moving.
For example:
All buttons (over 1-9, Power Off, Menu ecc.) should always stay at the same position (in releation to the selected device and screen resolution).
I can't get it, that all buttons stay over the designed photoshop elements.
Please give me a good advice, to solve this issue.
I would recommend using size classes and Autolayout. This type of thing is exactly what they are made for.
This youtube video is a great introduction to size classes and some Autolayout:
https://www.youtube.com/watch?v=IwSTXY0awng&feature=youtu.be
So, the question:
Is there any way to use a simple .xib or something like it, to have a splash screen with just a solid background extending the full width and height of the screen with a single, centered image?
I'm just learning iOS development and Objective-C.
I'm trying to find a simpler way of creating a splash screen for an app without using the traditional loading images.
Why?
In android development, I can use a fragment as a splash screen and place a single image at the center on a colored background. This will scale for ANY screen size, in ANY orientation.
In iOS development, they want me to create multiple image files for every orientation and screen size. This is not very scalable. If the logo or design changes, every one of these files has to be recreated and added again to the app.
You need to understand that the launch image Apple requires you to include is not for the purpose of being a splash screen. It is there to make the transition from the launchpad into the splash screen smooth. Yeah, it doesn't scale well, but it's just one image - you can handle it.
I don't know how to do it using auto layouts, but the old school way would be to place a UIImageView in the centre of the view set its autoresizingMask property to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight. In Interface Builder it would look like this: