iOS 7 AutoLayout sticky button to bottom screen - ios

I have read lot of documents and tutorials about autolayout and constraints but I don't know what I'm doing wrong but in my case the examples doesn't work...I know that this is a repeated question but I don't know what I can do...
I'm trying to fix a button to my bottom screen. Bottom with 0 distance. In 4 hinches screen all is ok but when I'm changig to 3,5" the button dissapear. This is what I'm doing:
Normal button
Select button and add the bottom space constraint
Button look likes fine
When screen size changes, the button dissapears
Thanks a lot!

You can complete the following steps to achieve that:
Add bottom constraint, width and height:
Add horizontal centre constraint:
Now you can test on your storyboard by clicking the Apply from factor button:

Select the button, and select "Update Frames"
Suggestion: you should add constraints to the button for left, right and height.

Related

How to center TextField using Xcode constraints?

I am new to iOS and am trying to align these TextFields in iOS. Below is how I would like it to look on an iPhone 7.
However, on the iPhone 7 Plus, the TextField shifts to the left of the center, despite my constraints.
Why is this? I have a constraint that aligns them to the Center, as seen on the right part of the screenshot.
It is very simple!! Just follow below steps,
Open you .xib or .storyboard file
Select view you have to add constraint
Click on align button at the right - bottom corner
Set horizontally in container constraint 0
Then press add constraints button
You can add any constraints to any view by following these steps
You just have to seth trailing and leading space fixed means both left
and right indicators should be red as shown in the screenshot.
For more details see the screenshots:
It will remain fixed from left and right in all the screens.
in your case is important set the width constraint.
However you can use trailing and leading constraints, in this way you will not need to set a defined width for your textfield and the position is correct for all type of devices.
If you want design like this so you have to take UITableview then take UITextfield for every cell beacuse you use every cell as view so easily manage all textfield and constraint. And also easily scrolling if device is display small.

Aligning two button images at a fixed distance in ios app-Swift

I am working on an ios app where I want to have two buttons at a fixed distance from each other. Something like below:
I tried dragging one constraint between the two images. But when I run it in simulator it shows overlap as below.
Can someone guide how to put both the pictures at a fixed distance. Also, I am seeing when I turn the simulator as right in hardware option some of my buttons are not getting auto aligned to horizontal screen and doesn't get displayed. How to fix this too?
Thanks
First of all clear all constraints. and follow below steps :
select both button with command button press
Give Width & Height constraints for both. (Pin at bottom-right side)
give Horizontal Centre in container constraints for both. (Align at bottom-right side)
Now, update all constraints (Resolve Auto-Layout Issue bottom-right side)
Hope, it's work..
Design your view according to this image
Drag a new view and then put your two button in it
Constraint for new view
Top
Horizontal center
Fix height and width
Constraint for left button
Top and leading
Fix height and width
Constraint for right button
Top and traling
Fix height and width
It will work defiantly.

Two Buttons. Above each other. Over whole screen

I just like two buttons above each other with no margins. This seems like an easy task, but I am new to iOS and I wasted too much time now. I tried dozens of contraints but it never went out well. I always ended up with setting the leading Spaces to -24 and having marings above and beneath the buttons. I am using xcode6, iOS8.1 and storyboard. My app is landscape only. Can someone please teach me what to do?
The buttons should look like seen in this picture: Fullscreen, no margins and Button1 should reach unter the statusbar!
I'll outline the steps:
Pin Button 1 to 0 spacing on Left, Right, Top
Pin Button 2 to 0 spacing on Left, Right, Bottom
Select both buttons, then Pin heights equally
(You can access pin either from the Editor tool bar in the top menu, or from the second icon in the constraints area)
The thing with constraints and auto layout is that you only need enough constraints to let the app calculate where elements should be at all times. You might be able to get away with less constraints.
To get remove the borders, you need to change the button Type in IB from System to Custom, then you can drag and alter the margins to remove them. Following that you will need to update constraints on the buttons.

XCode alignment/spacing between Storyboard and Simulator?

so my storyboard look like this
But when I open on iOS simulator, the item (playing card) is off to the right
What is wrong with the spacing/alignments of Storyboard?
(This is with the most recent iOS 8 and XCode 6)
Select the playing card ImageView and press the Align button in the auto layout toolbar.
Check the Horizontal Center in Container, ensuring the value is set to 0, and click Add 1 Constraint.
Then press the Pin button and add a top spacing to nearest neighbour constraint of 0, as so:
Add constraints to make it horizontally centered in the view. It will do.
See Apple's document, it will help.
I was literally bugging out about this same problem with the same example. I finally figured it out.
First constrain the size of the button. Then with descending contraints: Align center x to center x of button. Align center y to center y of button. BINGO!! Thanks for your input. #Adrian Sluyters. I firth thought the Detail View was a zoomable view, but the constraints simply adjust where the center of the view is. Lesson learned.
See my post:
Detail View on Storyboard too zoomed in - creates misaligned objects in simulator

iOS Universal App layout all messed up on iPhone?

I am trying to make a universal app in Xcode 6 using swift, and it's not going so well. I have a tab bar controller app, and I am trying to make something like this:
(The height and width are set to Any) But when I run it on an iPhone 5 simulator:
How do I fix this? Will I have to make separate storyboards for each device?
I solved this issue by clicking on all of my items, then clicking on this guy near the bottom: Then clicking "Reset to suggested constraints".
What I understood is that, you should probably pin Top Space for the top most label and pin Vertical Spacing constraints for the other two buttons.
The "GO" button should have a vertical spacing constraint with respect to the "Control" label and the "STOP" should have a vertical spacing constraint with respect to the "GO" button or Bottom Spaceif you want to stick it to the bottom of the view.

Resources