Constraints on a Vertical Stack View with 3 Images - autolayout

I have just started coding so forgive me if this is a very simple question but when I try to autolayout my stack view, I can't seem to get everything in the screen? When I change the top and bottom, 1 of the images gets truncated:

Make sure your Stack View properties are set to:
(with whatever vertical spacing you want)
Then constrain all 4 sides of the Stack View to the view (best to always respect the safe area):

Related

Dynamic UI in Xamarin.Forms

I would like to add a scrollable menu to a mobile app page.Here Transfer, Accounts, Payment and Transaction are generated from an XML file.The rest is static layout.I am using Xamarin.Forms.I would like to know how to generate UI components dynamically and attach them to a placeholder using Xamarin.Forms.
Dynamic UI creation is simple like the people said and there are many examples. But i think the problem is creating your own control according to your needs. For example i ended up with writing my own button with image in it like this:
So you have to write a method that creates a vertical stack layout (lets say outer container),and add a horizontal container to that "outer container" (lets say inner container) than add an image and a label to this "inner container" and make "innerContainer.HorizontalOptions = LayoutOptions.Center" etc. If you want border it goes complicated :)
Vertical Stack (whole container)
->Vertical Stack (height 2px) upper border
->Horizontal Stack (to hold middle controls,left border,inner image and text holder, right border etc.)
->Horizontal Stack (width 2 px) left border
->Vertical Stack (layoutOptions=Fillandexpand)
->Image (layoutOptions=Center)
->Label (layoutOptions=Center)
->Horizontal Stack (width 2 px) right border
->Vertical Stack (height 2px) lower border
So you have to join the controls like this hierarcy. First think how can you draw your control with existing controls than code it :) Hope i made my self clear.
i think you can use "Collection View" which is new feature of xamarin.forms or "bindable layout" to make it dynamic.

WatchKit WKInterfaceGroup, one label on top of another?

Simple question: is it possible to stack one WKInterfaceLabel on top of another inside a WKInterfaceGroup? I’m dragging like a mad man and I cannot get the blue target line to setting above or below the first label. It’ll sit beside it, to its left or right, but it won’t settle above or below it.
I’m trying to do something inside a table row akin to a master/detail, but I simply can’t figure out if it’s possible.
You can set the layout of the WKInterfaceGroup as Vertical and that will make your labels be one on top of the other.
This happens because WKInterfaceGroup doesn't work like a view, it has a layout flow that automatically arranges the inner WKInterface's as specified by the Layout property that can be horizontal or vertical. You can also tweak the appearance with custom insets.

Bootstrap grid and responsive images layout issue

I'm very new to some of this, including getting the Boostrap grid down. I'm trying to create a responsive layout where the business graphic essentially slides to the left as you make the screen smaller so that by the time you are at a mobile size, the title, subtitle, login buttons and image are all stacked and centered, and the business graphic still looks like it's sitting on the grey line. For some reason, my image 'jumps up' when making my page smaller and I do not understand why. It should justslide along the grey line and scale down as needed..or that's at least what I am trying to make it do.
Here's a link to what I currently have: http://dev.blueeyesdesign.net/plm/homeimage.html
Any help is greatly appreciated!
It is "jumping" as it hits the thresholds of the columns. When you are using col-xs-# col-sm-# col-md-# etc all on the same row.
Those all stack at different points. Use the same col-[size] in the row if you want them all to stack at the same time.
http://getbootstrap.com/css/#grid-options
Edit: The higher the threshold the earlier the columns will stack.(ie: col-lg-# will stack first, col-xs-# will stack last)

Resizing the superview according to the subviews

I have 3 subviews(UILabel, UIImageview, UIButton) to be laid out on a container view. All the subviews are laid out using visual format language (VFL). The subview have padding from the leading , top edges etc. The content of the subview are dynamic so their sizes changes all the time. i want to resize the superview(container view) to exactly fit all the subviews. Is this possible by auto layout? i have seen some of the link here which suggest intrinsic size which i am not able to understand. can someone suggest a better way to achieve this.
Yes, it's possible. If you plan to resize the superview according to subview content, then intrinsic content size is the way to go.
The ever excellent Ray Wenderlich site has a tutorial that covers this well. It's Beginning Auto Layout in iOS 6: Part 2/2:
Intrinsic Content Size
Before Auto Layout, you always had to tell buttons and other controls
how big they should be, either by setting their frame or bounds
properties or by resizing them in Interface Builder. But it turns out
that most controls are perfectly capable of determining how much space
they need, based on their content.
A label knows how wide and tall it is because it knows the length of
the text that has been set on it, as well as the font size for that
text. Likewise for a button, which might combine the text with a
background image and some padding for the rounded corners.
The same is true for segmented controls, progress bars, and most other
controls, although some may only have a predetermined height but an
unknown width.
This is known as the intrinsic content size, and it is an important
concept in Auto Layout. You have already seen it in action with the
buttons. Auto Layout asks your controls how big they need to be and
lays out the screen based on that information.
It is possible.
In my case, I wanted to give rounded corners to segmented control. For that, I embedded segmented control in UIView. Now I was required to resize that container view as per size of segmented control.
I gave only following constraint and everything was taken care itself.
(1) Chose container view and give it X and Y constraints.
Leading space to Super view.
Top space to Super view.
(2) Chose container view and give Leading | Trailing | Top | Bottom constraint.
Leading space to segmented control.
Top space to segmented control.
Trailing space to segmented control.
Bottom space to segmented control.
(3) Chose segmented control and give it Height and Width constraints.
Height : 30 // Whatever
Width : 250 // Whatever
Now if I change the height and width of my segmented control, it automatically adjust container view's size (super-view of segmented control).

Flex: preventing tree's vertical scroll bar overlapping view

I have an mx:Tree, but when the vertical scroll bar appears, it overlaps the content of the tree (odd that the horizontal bar does not). That might be acceptable for the text, but the stripe that I create using the item renderer, for certain items, seems to make it an anathema to the QA guys. How can I keep this from happening?
I have an idea for a workaround: I could make use the item renderer to stop the drawing a little bit short of the right side of the view (not that I can reliably get the width of a scroll bar) but I can't even figure out how wide the displayable part of a tree is--all the properties of a tree seem to be about its entire width, which includes the entire area coverable using the horizontal scroll bar. However, the blue stripe signifying a selected item doesn't seem to have that problem--it stops short of the scroll bar. In any case, when trying to find the displayable region, I don't know if I could handle the added complication of when the horizontal scroll bar is moved. Much better if someone could tell me how to put the veritcal bar outside the displayable tree area (or shrink the displayable area, of course). Thanks.
I'm using the Flex 3.5 SDK
I was able to find the solution when researching horizontal scrollbar issue on list and tree component. The blog to which it links eventually shows a kind of hacky solution (in the readers' comments) that shows how to make sure that none of the drawing is done beyond a certain boundary.

Resources