I'm looking for the following:
I have an object in the .nib file a (box). Whatever happens to the window, resizing, maximizing,... I want the box to be at the same place and have the same width and height at all costs.
How is this possible?
thx!
Since xCode 4.3 I think, objects use auto layout. To disable this, go to the first tab in the inspector. Then uncheck "use autoLayout". Then just go to the layout tab and in the "autorizing" box chek the arrows going from left to right and up to down! Here are some images:
1.
2.
Related
I have a view controller that's fixed size (it can not be resized). This specific view controller is presented as a sheet in a window, I disabled the resizing by setting preferredContentSize. Since it can't be resized anymore, I left the view without any constraint. However, when I build the app, I got a lot of warnings that says :
Views without any layout constraints may clip their content or overlap other views.
I do know that if you don't add any constraints in a standard window it will clip when it is resized. However, resizing is disabled on my specific window so that I know it won't happen. Is there a way to silence this warning? There are a lot of views on this specific view controller and it's blocking other useful warnings that I may encounter in the issues navigator.
This view controller is presented through a "Sheet" segue.
I had a single warning saying the same thing.
Editor > Resolve Auto Layout Issues > Add Missing Constraints
worked for me.
If it doesn't for you, something else under "Resolve Auto Layout Issues" might work.
For me what worked was the reposition the elements: Drag them again into position and drag their height and width to the desired size again. Then click on "Resolve Auto Layout Issues" and click on "Reset to Suggested Constraints".
Since no one answered this, here is how I fixed it. For each view on the form change the Layout option from Automatic to "Translates Mask Into Contraints". If you want it anchored to the upper left corner, select the top an left red handles and leave the lower and right unchecked.
For me what worked was; select the last element that cause the warning
size inspector tab > layout > Autoresizing Mask
I wanted to know how would I set a tag in the IB of Xcode. I currently have not done anything to try and fix this.
It's pretty easy. Just go to the storyboard, click on the view you want to tag and look here:
Make sure you're on that 4th tab at the very top, the Attributes Inspector
If you don't see a side bar, make sure the right drawer is opened by tapping on that right-tab-icon on the VERY top right corner (the one that's blue in my pic, it'll be gray if its closed)
Problem: UIView size is "locked" when designing with Auto Layout in IB
I've uploaded a 20 second video that illustrates my problem, but let me describe it. You may recognize the project: it's right out of Apple's WWDC 2012 "Introduction to Auto Layout." I've got a simple iPhone view in Interface Builder where I've already got a button and label along the bottom. The next step is to add a UIView. Here's where things get ugly.
When I drag the UIView out of the palette in Interface Builder and onto the iPhone window, as soon as I let it go it seems to become locked in to its starting size. I place it in the upper left corner, and I'd like to drag it horizontally to the right side of the window, and vertically to where it will be up against (minus the padding) the button and label along the bottom. But, when I try to resize it, I cannot. It's stuck on its original size!
The video illustrating my problem is here:
http://www.youtube.com/watch?v=jsW4UwnCEkw
You can see me grab the right edge of the view and try to pull it along to the right side of the window, but it won't expand. You can then see me move the entire view to the right side (it retains its size) and then try the opposite: grabbing the left side and trying to expand it so that it sizes up against the left side of the window. In both cases, the view is simply locked to its original size.
What gives! Auto Layout in Interface Builder is just the most frustrating thing. How do I resize a view by dragging? Thanks!
(Note: Xcode 4.6.3.)
In IB, in the series of buttons in the lower right hand corner, click on the rightmost button:
When you do, you'll see a "When resizing Views Apply Constraints To..." pop-up menu:
Make sure that "Siblings and Ancestors" is not checked.
I find the new auto layout feature in Xcode quite useful. However Xcode always displays the auto layout constraints as blue guide lines. This is sometimes annoying because these guides are displayed at the centers and edges of the views right where also the resize handles are.
So sometimes I can't resize a view by dragging the handles because I just can't grab them. A click will always select the blue constraint guide line. (And I have to resize using the size inspector).
Is there a way to (temporarily) hide these constraint guides?
In the main menu go to:
Editor > Canvas > Show constraints (toggle this to unchecked)
From this menu you can also show/hide layout and bounds rectangles, selection hgihlights and resize knobs.
This is fixed in Xcode 4.5.2
To completely turn the new layout system off, just uncheck "Use Auto Layout" in the File Inspector:
How can I change the z-value, or just send to back or to front the objects in Interface Builder?
i.e. I would like to move to front the "Label" in this View:
You need to reorder then in Interface Builder. It seems like you're using Xcode 4. So, first, click on the arrow in the bottom left corner of IB to expand the side panel:
Next, click and drag the views that you'd like to rearrange.
The lower an item is on the list from the top of the list, the higher its "z-index".
with that object selected, goto (menu) Editor>Arrangement> . There will be 4 options with activated appropriate options.
xCode 10.3 (2019):
I had the same problem when copying/pasting a background image view. I couldn't drag it to change its z-order in the Document Outline panel (in Interface Builder).
The answer was just to restart xCode.
I think that re-indexed/re-built the storyboard and I could drag it higher in the list (thus making it lower in the z-order + behind the other controls).