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)
Related
seems like Apple change how Interface Builder behaves in Xcode 8? Because when I check hidden in Attributes Inspector on a view in Interface Builder, that view is still visible.
This makes it very tedious to work with views where some views needs to be the view with the highest "z value", the front most view that is.
Is there some other way to show the green view in this example, than to change the order of them to the right (i.e. change their "z value")
In the image below hidden is checked, but I still don't see the green view below. You can download this trivial project at github
When the project is run, the green view is indeed shown, but the issues is that it is annoying when working in Interface Builder.
Am I missing something?
I have the same opinion on it and I also believe that it's annoying. I with they gave you the choice to update the actual storyboard before runtime or not but they didn't so for now we have to deal with it.
There is a quick alternative option though. Hidden will not update in the storyboard but alpha will. If you change the alpha it will update in the storyboard so if you want to see the view behind it just change alpha to 0. You can always change it back easily or if your doing it in code, instead of unhiding your view just change the code so the alpha is set to 1.
How about unchecking the installed checkbox of the red view?
This has also the flaw that you have to remember to reinstall it, but you don't have to change the z-order of your views.
This is deliberate. We wouldn't want a view to be hidden from you, the editor, just because it will be hidden when the app runs. You can easily select a covered view, such as the green view, using Shift-Control-Click on the red view (or use the document outline at the left of your screen shot).
In XCode 7, on a Swift 2 project, when I place a label onto the View, why is the label centred in XCode, but in the Simulator it's show off to the right?
This is just playing at the moment, where I don't want to play with constraints just yet (which I believe will be used later).
I had the same problem when working through a demo, and this worked for me. Try using the 4.7 inch size view controller:
Look in the middle left hand menu (the Document Outline), if not shown it’s under Editor > Hide Document Outline (a misnomer, clicking it will Show or Hide it).
Click on the View Controller so it's highlighted.
Click on the 4th tab of the right hand one (Utilities: the Attributes Inspector). If not shown it’s under View > Utilities > Show Attributes Inspector.
Under Simulated Metrics is a Size option to change from “Inferred” to “iPhone 4.7-inch”.
You'll need to realign things again, but now these should look central in the View and in the Simulator.
Constraints, when you want to get to them, will probably be more helpful in this regard.
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'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.
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).