I'm really new to the adaptive layout scene. I'm working on a project that I want to look really great on all iPhone screen sizes.
The question I have is: Is it possible to place a text box in a specific spot on each screen? The specific situation is that I have an image that takes up a majority of the screen. And I want to place an input box on top of that. Here is a screenshot to give you an idea of what I'm talking about.
And here is a screenshot to kind of show you how I have the background image set up.
The background image is placed perfectly and looks good on all screen sizes.
Do I need to place the textbox specifically for each screen size using size classes?
Related
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.
I am using the Auto Layout feature, and I would like to know if I can use different image sizes for different screen sizes.
Here's what my Storyboard File looks like.
As you can see, there is an image of a guy. How do I keep the size of image proportional for every screen size? Let me explain.
On an iPhone 4" the guy image should look a little bit smaller than on an iPhone 5.5". Is this even possible?
On an iPhone 3.5" the image should look small. On an iPhone 4" the same image should look a little bit bigger. On an iPhone 4.7" it should look even bigger, and so on.
Setting up constraints doesn't help,
Please take a look at the following image:
There are two iPhones and the guy image should look different on both the devices. On the iPhone 4S the image should look smaller to fit nicely the big grey dot while on the iPhone 6 Plus the guy image should look definitely bigger to get the most out of its screen size.
Is there any way to do it?
Thanks you.
So, you have to understand what's AutoLayout and Size Class first. AutoLayout basically helps you place the UI elements. And the Size Class enables you to have the control on the constraints you added on different screen size.
What you need to do is set different version of constraints for different screens. You can see the options in the assistant editor(right panel). They have you the options to choose apply for "All Size Classes" or "This Size Class".
Better you go check the documentation and the WWDC video. It has the complete explanation: https://developer.apple.com/library/ios/recipes/xcode_help-IB_adaptive_sizes/chapters/EnablingAdaptiveSizeDesign.html
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
I've just started writing iOs apps for work and I came across this problem which has to do with resizing my buttons on a screen to suit both the iPhone 3.5 inch and 4 inch. If you look at the screenshots below you will probably get the majority of what I am trying to solve.
So our designer has designed the layout whereby as you can see the colour buttons are supposed to fill the height of the screen for both iphone sets of devices, minus the height of the stautus bar and the navigation bar of the app.
I've had a look around a liitle bit about auto-resize, however I don't feel it is suitable for the requirements as you can see in the image.
Another approach that I thought about was in code, I would write an if statement, to determine if the person using the app was on the iphone 4 inch then load different images. However upon thinking about it more detail I would have to change the position for each of those buttons to ensure that the newly loaded images to prevent overlapping.
My question would be is there a way to change the position of the buttons in objective c to achieve what I want according to the screenshots?
Also it would be greatly appreciated if you can tell me if I am on the right track on the approach of my current problem.
Thanks heaps.
If you don't want to use AutoLayout, then I would advise turning it off in Interface Builder so you can control the frames manually. As for controlling the frames, make sure each of your views that you want to edit is accessible to your code (either its an IBOutlet or you manually instantiate it) and then adjust the myView.frame property. myView.frame is a CGRect, so you can edit it like this: myView.frame = CGRectMake(x, y, width, height).
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: