I'm trying to make a clone of jsfiddle. This is a 2x2 layout. I found jQuery-UI Layout which works perfectly... accept it seems to require a "center" pane, which doesn't exist in a 2x2 layout.
How can I disable the "center" pane? Or how can I make a 2x2 panel layout using "jQuery UI-layout" or another plugin?
Simply consider one of your "column" as center pane, and then divide it horizontally in two sub-panes. You have to think it such as a "nested" layout.
Related
Let me trying to explain my question.I have noted from long time during app designing in Storyboard/Xib. In all cases for eg while dragging some controls into storyboard obviously it shows the blue lines helps to us place controls correctly.But it's seems prevent controls from UIView(main view) layout to place edges on controller.
When we trying to place controls the blue lines prevents us from edges.see below image
But why constraints always zero even we are not placed at edges..it should be approximately 10,10,10..,
So my Qus is
Is Storyboard/Autolayout preventing to place controls at edges?
If yes.Then why all constraints is Zero ?
If No.Then what is the use of corner blue lines(eg:first image)?
They are the content margins of each view which are 8 points away from its actual borders. Please check this answer, which is explained it in details. Also you can place controls in the edges, just unchecking the constrain to margins will do that
Storyboard/Autolayout is not preventing to place controls at edges, you can always place your objects there and apply auto layout by unchecking "Constrain to margin" option in auto layout menu.
It is zero because "Constrain to margin" option is checked. Placed object distance will be calculated from that bound margin line as long as "Constrain to margin" option is checked. Uncheck it and you will get exact values from edges.
The use of this blue line is... if you add any UIScreenEdgePanGestureRecognizer, it will work outside those margin lines. placing an object between the edge and provided blue line may interfere with this kind of gesture recognizers.
So I have created my webapplication and when I build it in xcode I have to under "Simulated Metrics" > "Size" set it to 3.5 inch since I have a iPhone 4s.
When I build it and run on the iPhone everything looks perfect, but I want this application to run on iPhone 5/6 aswell, but when I change the size to something else in the Simulated Metrics it gets really messed up on my iPhone. I'm using a webview of my responsive website which shouldn't really care about the screensize but I believe Xcode does. So, is there a solution where xcode automatically detects screensize and makes the webview take the whole viewcontroller? Or do I have to create a application for every screensize?
So, is there a solution where xcode automatically detects screensize
and makes the webview take the whole viewcontroller?
Yes - xcode provides ways to do this. Either through auto layout or using springs and struts. With auto layout you will define a set of rules that your UI will follow. If you want 1 layout for all devices it's fairly straightforward and any tutorial will get you started. with springs and struts you just tell your views how they should grow/stay put depending on screen growing. check this out for a quick introduction to auto layout: http://www.raywenderlich.com/83129/beginning-auto-layout-tutorial-swift-part-1
Or do I have to create a application for every screensize?
Nope.. but you can set different constraints in auto layout for your views to behave very different on different sizes. This gets a little more tricky..
No you do not make a new app for every potential screen size, instead you uses XCode's "auto layout" with a set of "constraints" controlling the size and placement of your widgets. A constraint can be a fixed size for the widget or a given distance relative to another widget (or the parent's border). It is not necessarily a fixed distance, it can also be "my widget needs to be less than 10 pixels apart from this other widget".
The "Simulated Metrics" you refer to in the bottom of the drawing area is only a visual help when laying out you your GUI, it has no effect at runtime. You can safely stick with "Any" width and height.
Read this tutorial to understand XCode's auto layout and constraints:
http://www.raywenderlich.com/50317/beginning-auto-layout-tutorial-in-ios-7-part-1
Quickly, these are the tools used to setup constraints:
In your case, assuming you have only one big view (your webview), you need to set up 4 constraints stating that the webview's left, right, top and bottom sides are 0 pixels away from the parent's left, right, top and bottom borders respectively:
Lay your webview in the middle of your drawing area
Click on it
Click the "pin" button; you will see this view:
Look at the upper part of the dialog: the small square in the middle represents the view you just clicked and the four red lines represent the distances to the parent's side. Set them all to 0 and click "Add 4 constraints". (Note: the lines are initially dashed when not selected; they turn into solid lines when activated.)
Now the frames in the drawing area do not represent what you were expecting: your webview is still in the middle where you placed it initially and does not fill all the available space; XCode is aware that there is a mismatch between the frames and the constraints and shows a warning. You need to update the frames: click the "issues" button and "update all frames".
The image comes from this question on SO:
What is "Constrain to margin" in Storyboard in Xcode 6
Read it to learn about the "Constraints to margin" switch.
I have previously been using VGScene (Firemonkey predecessor) to create an application and have recently switched to Delphi XE2's Firemonkey.
To scale my form in VGScene all I had to do was to scale the Root object of the VGScene object to scale all content in the form. However I am unsure how this should be done using FireMonkey.
My form consists of two TLayouts, one left aligned and one set to Client align, with a vertical splitter control between the left and client layouts. The client layout also has a list box on it set to client alignment.
I have tried having a base TLayout with all my controls on it, and scaling the base TLayout but this doesn't quite work properly, the left layout scales properly, but the client layout's listbox seem to extend past the right and bottom edge of the client layout object? i.e. when you have a full list the list items extend past the right edge of the form, (which are cut off) and the vertical scrollbar isn't shown completely either as it extends past the bottom of the form. It is as though the client layout's width and height are scaled to that larger than the form allows, but should it not still fill the form's area?
I have tried to just scale the individual object's, like just scaling the listbox, but this produces the same result, the listbox extends past the bounds of the form.
Anyone have any ideas?
One possibility is that you didn't quite follow exactly the instructions for laying out your controls and splitter, as recommended on the TSplitter documentation?
If you didn't, it is easy to get to a point where all the properties seem to be set to the right values, but somehow the controls and splitter just don't cooperate. I would recommend trying again, paying careful attention to getting the align properties with the correct values, i.e. alLeft on the left component, alLeft on the splitter, and alClient on the right component.
Just started testing FireMonkey and can't find a way to make dynamically sized/positioned components.
VCL had the Anchor property, FM does not.
Anybody see something I missed
Update:
Simple anchoring is not available in FM. You have to create TLayouts and align those, then put the controls inside the panel to have them 'stick'. If you used older version of Builder or Delphi, this will be the same as we used to have to do with TPanels.
This is the answer to your question. The anchors property in VCL has apparently been replaced by Margins and Padding (due to performance considerations) and I found some documentation at the XE2 wiki (http://docwiki.embarcadero.com/RADStudio/en/FireMonkey_Application_Design). I doubt if anchors will be put in at a later date. To anchor two buttons (Ok and Cancel) at the bottom of a form on the right side do the following.See images below for the Ok and cancel button.
Place a small panel aligned to the bottom on the form, say about 40 height. Set the 'Margins' on the bottom panel to create a smaller space in which the buttons will live, make sure you set the align the button to alRight. For example the gap between the right edge of the form and the right most button has a margin of 15. The top and bottom margins were set to 12. That anchors the right most button.
'Padding' is the opposite to a margin, the padding puts space outside the control. To the right most button I added a padding of 20 to the left side, this will be the space between the two buttons. For the second button to the left of the first all we need to do is set the align property to alRight, no need to adjust the padding or margins.
Drop multiple TLayout components on the form and configure their alignment properties as desired. Drop other components into these layouts and set their alignment properties relative to the TLayout they are contained in. Seems to be working for me...
Here's the answer you are looking for: FMX controls do not have anchors.
I imagine this will be a "next version" feature.
A quick look at the align property reveals many more choices than we had in previous Delphi versions:
Doesn't that solve your problem (at least partially).
I remember getting by OK for a long time just using nested panels and align to layout stuff.
You can use LiveBindings and expressions to set the properties of your control based on the parent control, though it's a lot of work.
Otherwise, use Margins and Padding (like HTML/CSS).
I have so far developed for Android. There, you can set layoutMargin and padding for almost every UI element (when you describe UI in xml file).
How is this done in code for UIViews in iOS (if there is a common command)?
Tnx
iOS employs a different approach to control placement - there's no layouting engine, you specify absolute coordinates and size for all controls. Kinda like the AbsoluteLayout in Android.
So the concepts of margin and padding don't really apply - the gaps between adjacent controls are completely up to you, they're not computed by the system. Same for sizes.
This makes it more difficult to implement the scenario of "make this control as large as it needs to be for its text". However, you won't run into rogue line wraps.
EDIT: AbsoluteLayout is deprecated these days.
You lay out your UI elements either in code or using Interface Builder (or the .xib editor in Xcode 4). You'll specify actual coordinates for your views, but you can also specify the resizing behavior for each view. So, you can say that a particular view should always keep the same size and remain horizontally centered, or that it should keep it's size and maintain the margin on the left, or that it should stretch to keep both left and right margins, etc. Look for the "autosizing" section in IB, or set the autoresizingMask property of any view in code.
In ios you can use Interface Builder for design. You can still use xml, but no one use this.