Align dropdown menu container - custom-fields

Hello,
I've been trying to align and set the width of the dropdown menu container so that it showed perfectly aligned with the field label in terms of position and width in all screen sizes.
Any Ideas ?

Related

Xcode 8.1 Auto Layout

Hi there I am currently trying to get the following Scene to scale correctly for any scene.
This is currently how it looks on a iPhone 7 Plus:
I managed to get it to scale the blue background correctly by adding the following constraints:
However, I don't know how to get the UIImageView, UITextField and UI Label to scale in the same way. I Want them to keep the same proportions as they have now on the iPhone 7 view. I have looked for youtube tutorials but none seem to show how to introduce a way to have these items scale as I want them to.
Any help is much appreciated, Thanks.
You can add constraints between UIImageViews, Labels, the window, etc. by holding control and clicking-and-dragging between two elements. For example,
UIImageView: add these constraints:
Vertical Spacing to Layout Guide (This constrains the top of the image to the top of the window)
Leading Space to Container Margin (Left side of image stays 'connected' to the left side of the window)
Trailing Space to Container Margin (Right side of image stays 'connected' to the right side of the window)
Vertical Spacing (vertical spacing between the image and the Label)
You can use this same idea to constrain the Label and Text Field to the left side of the window and to keep the vertical spacing between the UIImageView, Label, and Text Field consistent on all devices.

How can I align and resize these two elements with Storyboard Auto Layout?

I am designing a very simple "Today" widget with just two elements: a text label (shown here with a red background) and an info button. I want the info button to always appear right after the label.
So:
the info button should always stick to the right margin
the label should always stick to the left margin
the label should resize itself so it is the full width of the available space, right up to the edge of the button
How can I do this?! Auto Layout is sooooo confusing and I've been playing with it for an hour with no luck. Can't figure out where to start. I think I need at least three constraints, one for each of the needs above...
Your info button will have a fixed width and height. Set its right margin to the parent right. Set your red label's left margin to parent left and right margin to info button's left.
Now since your red label doesn't have a width restriction, it will take all of the width between left margin and right margin.
This is how it looks.
You should create top, bottom, width and trailing (to the container view) constraint info button.
For the label, they should be leading, top, bottom (to the container view) and horizontal spacing to the info button.
Hope that will help.

How to equally space items in Xcode storyboard?

I want to have 15 buttons equally spaced between them and correctly leading and trailing the superview vertically. I set constraints so that the left set of buttons aligns to the left margin and the right set aligns to the right margin. The first button leads from the top margin in each set, and the remaining buttons each have a constraint for vertical space set to the upper neighbor. I thought this would be enough to make it work but it wasn't. As you can see, for an iPhone 4, the number of buttons displayed on the screen is only 12 so I would definitely need to somehow dynamically change the button size depending on the screen size. I am attaching a screenshot from the storyboard that shows the Any x Any editor view and a preview for the 3.5-inch screen.
This was really easy to accomplish using stack views. Simply select all the buttons and click the leftmost icon (bottom right side of left pane) which is named Stack, and see the magic happening!
Try to set the constraints like this:
First select the all elements on left side and give leading constraint:
Now select first element and give top constraint:
Now select the second element and select it , and drag it to first element and give vertical spacing: , repeat giving vertical spacing for all the elements, So that each element will be vertical space constrained with its top element!!.
Do the same for elements on right side.
Give the trailing constraints for all elements on left,
and the select top element and give top constraint
and then select one element below top element and give vertical spacing between those two, repeat it for all the elements!!! So that each element will be vertical space constrained with its top element!!
Note: I only gave left constraints, you can try for right side too!!!!!
Add height constrain to the top left button to be 1/15 of the superview height and for all buttons let their height equal to the top left one.
Note it will work only if the vertical spacing is zero between buttons.
If you have a vertical space value for example x, then set it as 1/15 - 14 * x
Note #2 in iOS 9 only, seems the stack view will help perfectly in that

How can I have one element align to the left and another one centered in Vaadin HorizontalLayout?

I wanna center my Label component in Horizontal Layout (I'm working on navigation bar) but I still want to have hamburger menu button aligned to the left side of the screen,
I tried to use
navbar.setComponentAlignment(myLabel, Alignment.MIDDLE_CENTER);
on my Horizontal Layout but this don't work, it only center in verticaly,
What can I do to achive that?
Vaadin Label is by default 100% wide, so you need to set its width to undefined to center it:
myLabel.setWidthUndefined();
Of course, your HorizontalLayout must be 100% wide (it's undefined by default).

Why is view resizing on aligning by horizontal center in container in Xcode 6?

I'm trying to align Text Field in View Controller with pressing "align" and selecting Horizontal center in container but then my Text Field get resized. Same thing happened with Image View. What am I doing wrong?

Resources