How to all iphone and ipad simulator to image center screen? - ios

I have created new app for iOS. The first initial page image has been added. I have checked the simulator with a different view. How should I the center of the screen shows the image, textbox and button? Please help me.

Do you know how to add constraints? What you need to do is set constraint to center screen horizontally and text box center vertical. After that apply top and bottom constraint to image and button.
You can follow http://www.raywenderlich.com/115444/auto-layout-tutorial-in-ios-9-part-2-constraints to lear more about constraints.

You can set it by giving just simply two constraint with giving height and width
Horizontal center in container and vertical center in container

Related

How to center image horizontal for all screen size in xamarin ios native

I want to center image horizontally.
Here is my activity :
As above you can my storyboard. There are two images. 1st Image in background which cover whole screen and that's perfect for all devices. Now i have other image which you can see horizontally center and its work fine with iphone 6s plus. But when i have checked with iphone5 and X this image its not in horizontal center.
I have used auto layout .
Here is the constraints:
How to set this image horizontal center for all screen size ? and also how can i give padding top same for all device screens size ?
Refer to Center Constraints
Drag the square handle to the vertical Center green line of superView,as illustrated by the screenshot below
I center image in this way:
And as I look is easier to make storyboard in Xcode and then copy to xamarin project.
--EDIT--
In your storyboard add image on center of view and click on image and then in the Constraint Edit Mode:
Next on the center of image you will have pin spacing
And move this pin to the horizontal and vertical line. All the time look at the properties Constraints
Then you need to add spacing with one of the side. I add on the right:
After this you need to set value of space. I use 10
After all of this steps i have this constraints:
Sometimes I have to uninstall and install again app on simulator or phone to see changes.
here is very simple solution
use frame mode
use arrange as in the image. choose all arrows on the left panel
Thus your image will be always in the center and resized for the device if you provide 3 sizes of images.

How to adjust this view with constraints

I'm totally new to Swift and in general, to iOS development. I just want to center a rounded profile picture with a table view above. In iPhone 5 it looks centered, but in iPhone 6 and 7 it look aligned to left, I don't know how to fix with constraints, I'm a little bit confuse.
This is my constraint tree:
How it looks storyboard for iPhone5
How it looks storyboard for iPhone 6/7
This is how it looks in emulator with iPhone 6
Can you guys help me to figure out what I'm doing wrong?
Thanks in advance!
Cheers.
It looks like you've set the width and height of your image view to hard-coded values, which will result in it looking centred for some views, but not all.
Reset your constraints, then set your distance from each of the four sides to zero. That'll centre your image!
Go to Editor -> Resolve Auto Layout Issues -> Reset to Suggested Constraints...
...then click that button down the bottom right and set each of your four sides' distances to zero.
Make sure you set Update Frames to "All Frames in Container" before clicking "Add 4 Constraints".
Try setting horizontal constrain between your My UI Image View and HeaderView. You can set centre hozintal with HeaderView.
Go to button down the bottom right and set centre vertical and centre horizontal to your My UI Image View.
Hope it helps. Happy Coding!!

Center the content horizontally when the device is rotated in iOS

I am new to iOS development. I have created a login screen using xib file. I have placed the contents aligned horizontally. But when I rotate the device the alignment is going off. Not sure how to stick to the same alignment when the device is rotated.
Please refer to the images for both scenario. Any advise is appreciated.
When the device is rotated
When the device is in normal mode
There' s a constraint, in "Align" that says "Horizontally in Container"
That's what you need
u can add your fields into a UIView if you want their size to be fixed , then just add Horizontal Constraint to this UIView and set UIView size, then all elements will just follow their parent view

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.

Place an image in the centre of remaining bottom area on iOS screen

I have placed an image on an iOS screen and in the area that remains in the bottom, I would like to place another image in the centre of that space. I could do that with Android using relative layouts. How can this be achieved in iOS auto layout?
Let the image view take up the remaining bottom space (fairly easy to do using auto layout), and then set its contentMode to Center.
This is an simple example.
Just select the Horizontal Center in Container after pin other required constrains.
And this is the final layout constrains:

Resources