AutoLayout positioning problems in iPhone - ios

My problem is on rotation (rotate left/rotate right), the UIImageView that I have created touching the bottom of the screen (which also has 2 buttons within it) disappears. I did a search in Stack Overflow and other online forums and I haven't been able to address this problem at all.
I have checked the "Use Auto Layout" option as well. I tried specifying various alignment constraints but to no avail. All I want is the UIImageView to be visible (along with the 2 buttons within it) when I rotate the device left/right. Xcode version 5.1.1, emulator type iPhone Retina (4-inch). Kindly let me know if you need any further information. Appreciate some help!

Does this image help or you need further explanation?
I added a button and specified a fixed width (200), as well as a leading and bottom space of 10 to its superview. That means that this button will always be at the bottom left corner.

Related

Label not pining to the right of a tableview cell

I'm trying to pin the points label to the right of a tableview cell.
Problem is when I pin to the bottom, top and right and then I change the size of the screen, the pin doesn't work.
I have been watching loads of videos and articles about auto layout, and I really couldn't find out why it is not working.
This is how I setup the Label 90 on a iPhone 8 screen
So to achieve this I set these constraints
But when I change to an iPhone 8 Plus screen, this is the result, the label 90 was dragged to the left
And when I go back to iPhone 8 screen, the label is not even showing on the screen
Your constraints seems to be right to see on all devices as you are keeping left (trailing) to 6, which is constant and will work same on all.
Please run on simulator, preview will only works better on same device to same preview, not otherwise as it doesn't do proper constraint like in run time.
Most important is to use UI debugger if any view is not placed well to get better idea where exactly the problem is.
Thanks.

Alignment issues in iPhone X

In my application i have a screen which contains close button on top and program information at bottom and both trailing,leading,bottom and top constraints related to safe area.
Button width and height is 1:1. Program info area height is 0.25 of view height. In run time adding avplayerviewcontroller view on screen whose height is 75% of self.view.It's working fine in all device except iPhone X. If i launch app in landscape then alignment is fine and if I change orientation I can see 44 pixels as x value. If I launch app in portrait first then portrait orientation values are correct if I change orientation to landscape then 44 pixels top(y) value is adding. I am not getting how to fix this issue. Please guide me.
[![enter image description here][1]][1]
I guess your problem is that you have defined constraints in percentages, which might be an issue. When you rotate the screen the mid section might be too small. Have you tried the rotated layout in interface builder to see what is happening? Defining layouts with constraints is relatively easy in interface builder and you can test the layouts as well.
If you programmatically set the constraints, it is hard to find out where it went wrong. If you have one ambiguous constraint, the whole screen can be weird.
If you need to make programmatically set constraints, you should make a test setup in interface builder and implement the good setting in the program code, when everything works as planned.
I have checked your storyboard and I think the issue might be that you have two safe area defined. One outside the containerview and one inside. What you put inside the container view, might be wrongly calculating the constraints inside.
Try to take out this checkbox and try it again.

Need help regarding safe area layout

I added constraints properly with respect to super view instead of a safe area but still I am facing an issue of grey area on top and bottom of specific screen.it should appear completely on the whole screen at I Phone X. Please follow the screenshot.
Check that you have a launch storyboard and not a fixed launch image
that does not respect the iphone x screen size
Check in your top and bottom constraint properties that they are relative to superview and not to margins (by default xcode 9 adds the constraints relative to margin).

UIView Doesn't allow swipe down to see rest of the screen

I build a view that has contents which exceed the height of the iphone 6 screen vertically.
To test that out, I've set a specific height for my image (600pts) to guarantee that the whole content wouldn't fit on the screen of an iphone 6 and that you should swipe down to see the rest (the label "BYE").
However, when I run the simulator, I cannot swipe down to see the rest of the screen.
I've used Autolayout constraint and set a margin top/bottom between each components and the superview (I don't have any autolayout constraints issues/warning).
Here's the screenshot of the storyboard of my UIViewController:
Here's when I run the simulator, I cannot see the Label "BYE"(which is normal) but I cannot swipe down to see it.
I am using Xcode 6.1 and Swift.
Any suggestion and explanations?
Thanks a lot!
I have redone your screen and here are the steps. The reason for your issue is not setting proper constraints in autolayout. First you need to choose AnyWidth AnyHeight in Xcode which is in bottom of the storyboard.
Here is the screenshots of View in StoryBoard and its constraints
Constraints
Final Result in Simulator
Setting the constraint properly will work for you. Let me know if you have any issues in doing so. Sorry for the image i used its low quality one and its just for test.
EDIT
In Storyboard if you see the bottom of the screen you will see below image. In center of that image there is wAnyhAny.
you need add constraint to thoes components!
Otherwise, some components will be placed out of the screen!
You can learn how to use Autolayout from here
![enter image description here][1]At right bottom of storyboard in xcode you will see triangel Resolve autolayout isuue select in Reset to suggested constraint.

Storyboard preview differs from simulator

I'm currently trying to grapple with constraints (using Xcode 6 GM seed). Using reset to suggested constraints, everything looks right in the universal storyboard and in the preview:
As you can see, I'm previewing for multiple screen sizes. All of them have the image of the dot (and the image itself takes up the whole view, set to draw in the center) in the center. However, when I load it on the simulator, I see:
I'm not sure why this is happening. As far as I can tell, the constraints are all as they should be:
Is there something I am doing? Or is there a bug here in xcode 6?
Thanks in advance!
You don't need to add Leading, trailing, and vertical space constraints. To place your dot in center you need to add Horizontal and Vertical center in container constraint. Place your dot in the center of controller and add these two like in the given image.
The storyboard "Preview" doesn't match the simulator if you have any constraint errors/conflicts. I was having this problem, and found this question while searching for an answer.
One I got all of the conflicts resolved, the Preview worked. It still seems like the preview should consistently show what the simulator would show to help during the setup.

Resources