In Xcode 6, I could use the Editor menu to Pin:
Leading Space to Superview
Trailing Space to Superview
Top Space to Superview
Bottom Space to Superview
I can't find a way to do this in Xcode 7 beta. If I press the Align button in the Storyboard view, I see:
Leading Edges
Trailing Edges
Top Edges
Bottom Edges
Which I assume is the same thing, but they are all greyed out.
Adding these 4 constraints in Xcode 6 would have taken about 20 seconds, but it took me 30 minutes to put it in Xcode 7 and can't figure it out.
Unfortunately they removed this option from the Editor Menu but there is a drop-down menu. There you can select another view to which you can assign your margins. .
To pin Top, Bottom, Leading, and Trailing to the Superview, do this:
Select the view.
Click the Pin button (looks like a TIE Fighter).
Under Add New Constraints, uncheck Constrain to margins.
Click the left, right, and top and bottom beams.
If you click Add Constraints button, it will pin top, leading, and trailing to the Superview, and bottom to the Bottom Layout Guide. If you want to pin bottom to the Superview also, press the drop down arrow next to the bottom value and choose View instead of Bottom Layout Guide. Then click Add Constraints.
Well, I also meet this problem in Xcode 7.2, and have found out a way to solve it.
In Xcode 7.2 (and perhaps also in your version of Xcode), firstly select the view that you want to add constraint to, and then press the "control" button on your keyboard and keep doing it, and then drag the view to the super-view. Then a menu will appear, and then you can select to add some constraints. After adding the constraint you can release the "control" button. Note that the direction you drag will affect the available constraints at this time. For example, if you drag left, then the trailing constraint may be unavailable.
Right next to the Align button is Pin button where you can set what you want.
When you add a constraint via Add New Constraints you have a choise:
By default Xcode uses Safe Area - Align Top To
If you select a superview - Top Space To
Related
I´m working on a tool only for tablets (Android, iPad) based on Cordova and jQuery Mobile (1.4.5). In the first phase of this tool, many of the users who have to work with it were asking for some more comfort regarding the behavior of the form popups.
The problem was:
As a user came to one section, I provided him with a collapsible-set, consisting of sub-sections. In this sub-sections, the user gets data-grids with Add, Edit and Delete buttons next to each data-set.
So, as the user tapped on Edit button (or Add), I opened up a popup with the necessary form and form-elements to edit this data-set or add new data to the database. But in many of the upcoming popups the amount of the form-elements is as high, so the popup appears higher or even much higher then the collapsible-set (including the data grid) behind the modal popup is.
The popup of jQuery Mobile is centered by default and even if I positionTo origin and pass x and y coordinates to it, the library/widget wants to position the popup to this coordinates by the center point, rather then the upper left corner.
Users always had to scroll around to come to the start point of the form and after submitting the form, they had to scroll up again to where they tapped on the button to open the popup.
Now I tried to do everything I could imagine, to force the popups top position to 20 pixels below the top position of the visible area on the tablet, regardless of where I am, when tapping on any Edit or Add button.
I was playing around with offset() (window.pageYOffset), etc. and set the position of the popup by:
popup2open.popup('open').css({'top':popupTopValue+'px','left':popupLeftValue+'px'});
In fact, the popup is positioned to exactly where I want it, if the top offset is between 0 and 100. On all values above 100, the top position of the popup increases by absolutely incomprehensible value. The only consistent fact is, that the more I scroll down before I tap on a button, the more this value increases - so it does not in/decrease by random.
(BTW: I found out that I have to set "popupLeftValue" to 0, so the popup is positioned in the center horizontally.)
I just can´t see any regularity on increasing value...
Can anybody give me a hint or a punch to the right direction?
Thank you in advance!
PS: I experimented also with .css({'position':'[fixed|absolute]','top':popupTopValue+'px','left':popupLeftValue+'px'}); and that worked well. Only to find out one show-stopper: If I set the focus to an input-field inside the form and than closing the virtual keyboard on the tablet, a reposition-event is triggered and by this, the popup is re-positioned massively below the former position (in fact around 300 pixels below and just marginalized to the right border of visual area). The Cancel and Save buttons are even out of scroll-able area.
(some more funny fact, btw.: if I set the focus to the same input-field, than not closing the virtual-keyboard but directly setting the focus to a select element and after this pressing the back button of the tablet to escape the select menu, no reposition-event is triggered...!?)
On 18th of July 2013 Gabriel Schulhof added this line to a feature-request from one user, who asked exactly for what I´m struggling around with:
"We are indeed considering adding such a feature..."
New to the auto layout world, i can't seem to right align a table relative to its parent content view in the cell. Left aligning works, but when previewing on smaller screens and when running on 6s, the label is not visible/cut off.
according to this thread, the solution was to make sure the tableview was pinned correctly to the parent view controller (0,0,0,0) - but still did not fix my label.
Any help is appreciated.
First of all, add top, left, right and bottom constraints to your tableView.
Also, your label has x position constraint, but how it should lay according to y coordinate? Add label top or bottom or centerVertically constraint.
And what about your redView? Set the needed constraint to it also.
I am writing an application where I need to move a view from top to bottom but only when user moves it downward. To move this view I have a button below the view to drag. So initially I place the view beyond top of the view i.e. with negative margin equals the height and only the drag button is visible at the top to user. I see that this works perfectly on Lollipop and view is just at the position where bottom of view matches the top of screen. When I try it on Kitkat and lower versions, the view goes more towards top than the edge of screen. I have this everything in a RelativeLayout.
To show that view is dragged downward I am manipulating bottomMargin and topMargin properties on view.
Has anyone came across similar problems? Thanks in advance.
In Xcode 5, I've opened a new project and added the following:
A Tab View Controller with two Tabs (thus two View Controllers).
In each Controller View, I've added a CollectionView, with both a Label and a Button under it.
I've applied the Default constraints. No warnings.
... clicked Run.
In the iOS simulator, the first Tab looks ok, all elements in the View are aligned to the bottom of the layout, which is the top of the tab bar. Perfect.
When clicking on the second Tab, instead of aligning to the bottom of the layout, it aligns everything to the bottom of the container. So all the elements in the View drop in height by that much. Clicking back to the first tab will now show this incorrect positioning as well.
Strangely, rotating the device fixes this... showing the correct alignments in both tabs and for both orientations.
Any idea what am I doing wrong?
Thanks,
I now believe this is a bug in XCode 5.
I got around it by replacing the constraint for a pin, like so:
Editor -> Pin -> Bottom Space to Superview.
We are using Plone 4.1.3. When we go to the Contents page of a folder, there appears to be Up and Down arrows in the first column of the table in the page for a split second. I suppose these Up and Down arrow are for changing the display order of the items and subfolders inside the folder. Since these arrows are now gone, there is no way we can change the display order of an item in a folder. Instead Up and Down arrows, there is just a icon showing 2 columns x 4 rows of tiny dots which does not respond to mouse click. Is this a bug?
Thank you very much in anticipation.
cmgui
Rather than clicking quickly, click-and-drag those 2x4 tiny dots up and down. You can drag items anywhere in the table.
With JavaScript turned off you'll see Up and Down arrows. Clicking one will move the item one place up/down. The split second change you see is your browser loading the JavaScript that replaces the up/down arrows with the draggable dots.