Xcode issue changes Storyboard elements position when a project is opened - xcode

When I open some of my project I notice that the editor automatically set the bound rectangles on and shift every UI element of the ViewControllers slightly to the left.
I don't know how to fix this without having to manually correct Views every time this issue pop up.

Related

Can't place a WKInterfaceButton underneath another one in watchOS storyboard

I'm building a storyboard for my watchOS app in Xcode 13.0, and attempted to place a new WKInterfaceButton underneath an existing one.
The new button refused to go beneath the other one. I dragged it underneath the other one multiple times, I deleted the new one and replaced it with another, yet it wouldn't go down.
The storyboard should be laid out as followed:
Label (placement already set up)
Button (placement already set up)
New Button (being annoying)
How would I be able to place it underneath the other button?
Link to video showing the issue: https://imgur.com/a/oZaHxfF
Double check the 'Attributes Inspector' for both buttons to make sure the alignment is set correctly.
If the Refresh button is set to bottom, other elements will always 'float' above.

Xcode 6.1.1 StoryBoard Size

Good morning,
I am new to Xcode and am learning to create iOS applications.
When I open a single view application and click on main.storyboard, my size is w Any h Any. When I decide to add a label and run the iOS simulator (iPhone 6 or iPhone 5S), the label appears somewhere else.
This is really frustrating and I have tried many approaches such as disabling use size classes, changing the storyboard size by clicking the w Any h Any button, and even messing with the constraints as mentioned here: Xcode 6 Storyboard the wrong size?
I am really trying to continue with this but I have seem to hit a wall for a couple of hours now, if someone could shed some light to why I am messing this up, that would be amazing.
EDIT: How can I get it to be a "normal" sized iPhone, such as the iPhone 5s?
You can click on the w Any h Any to change it to a normal iphone size by mousing over the squares and reading which devices they encompass.
You are going to have to use constraints though in order to make anything go where you want it to, I really didn't want to learn them but I couldn't do without them now: they are very useful.
EDIT
Constraints are simple in concept but can be tricky in certain situations:
For any view to have valid constraints that work correctly, it needs to know what the size of the view is and its position in it's "parent container" which is just whatever view or viewController it is inside of.
The little |-O-| shaped button and its neighboring buttons next to "w Any h Any" give you options for positioning and sizing the view. So if you click on a view and then click on that square button in the middle, check the width, height boxes and click the left and top lines in that top positioning thing with sizes in it like so:
Then click on add 4 constraints. You will notice blue lines appear around your view saying that it can properly put it where it needs to go when running the app. If there is any orange or red that means there are conflicting constraints on the view.
Sometimes that can mean you put to many constraints (more than you need) and you just need to delete them in size inspector tab. But more often than not, if that doesn't fix it, I've noticed that I usually have a neighboring view that isn't properly "constrained" and is actually the cause for the other views problems.
How can I get it to be a "normal" sized iPhone, such as the iPhone 5s
You don't. The view controller's main view will be resized correctly when the app runs (on a device or in the simulator), as appropriate for the device type and other aspects of its surroundings.
Your job is to use auto layout so that no matter how the view is resized, its subviews (labels and buttons and so forth) will look good. That is what auto layout is for - it's to help you compensate for the fact that you have no idea what the real size of this view will be at runtime.

Overlapping cells in static tableview built using storyboard

All,
I'm using the Xcode 6 beta to build an iOS8 project using storyboard and swift. In the storyboard, I've created a Table View Controller as my primary view when the application loads and have added a label to the first cell and a label to the second cell.
The table looks fine in the storyboard, but when I run the application, the cells overlap. This is a brand new project with no other changes made or code added.
You can see both the storyboard and the running application in the photo below. Any ideas on what could be driving this?
Additionally, when I try to add a button to one of the cells, I get a grey box that covers 90% of the view.
I think I've had this issue. Try making some Auto Layout connections from the label to the Content View of the cell, and from the table view (and its cells) to the containing view, to force the views to be the proper size.
The following worked for me.
Control-click and drag from your label to left side of the cell it's in. When the modal comes up, check the box for 'Leading Space to Container'.
Repeat the same Control-click and drag process for each side of the cell, selecting the relevant Auto Layout option when it appears.
(Optional) Try to Control-click and drag from your table view to the each side of the containing view (if there is one), and repeat the steps from above.
Hopefully this works for you.

Rearrange Tab Bar items not working as expected

Following on from this question, I have so far been unable to rearrange tab bar items in my iPad app.
I have zoomed in as far as I can go and double-clicked the tab bar controller so that it is highlighted in the Document Outline inspector.
I then try to click-drag individual items left or right but nothing happens, i.e. I'm unable to select them.
Following the comments on the other question, I've tried clicking on another .h or .m file, then switching back to the Storyboard. I've also tried closing x-code and restarting but neither made any difference.
Can anyone tell me what I'm doing wrong?
In the end I took the brute force approach of deleting the segues then reconnecting in the preferred order.
Not particularly elegant but it did the job.

XCode: Moving UI-elements in storyboard editor

Is it possible to lock or freeze elements in storyboard editor so that they are ignored, when clicking and dragging?
My problem is that I have several elements underneath two big UIViews that cover the whole window. So in order to for example move a button underneath them I first have to move the big views out of the way, move the button, then move them back.
Is there a better way?
When I select the element in the tree-view on the left, it gets deselected as soon as I click on the storyboard. Perhaps there's a keyboard shortcut to keep the selection while dragging?
There isn't I'm afraid, at least not that I've ever been aware of.
You can use the object navigator / tree-view on the left to select your items, then you can move objects around using the x/y/w/h properties on the size inspector.
Another solution could be to set the items you don't want to drag around to hidden while you're dragging other elements around.

Resources