Update constraints menu all greyed out - ios

When I try to update constraints in Xcode 6.3, I can't because the menu is completely or partially greyed out.
http://hostthenpost.com/uploads/aa150beda71316c338da81c5e301d149.png
Why is this? How do I fix it? The app is a basic, simple Hello World app with two UIImageView elements both sharing heights and widths, and one is constrained 50 from the left, the other 50 from the right. What is wrong with it? How to I make it so I can update the constraints?
Edit: This is when I can see some, but not all of the constraints options.
http://hostthenpost.com/uploads/2d8a3bec6a17524d6f9ca1524c95fb0c.png

That happens when you have a wrong item selected, meaning for example a constraint instead of the view or a subview.
To fix it, just select the view again. Then the options should show up again.
Still some options will be grayed out, if they would have no effect when clicked. For example Update Frames will only be available if there are actually are frames to be updated.

If you clicked on the main view and then on the constraints button, you have to know that you can't adding constraints from the main view in the storyboard, to its superview. You can do this just by code.
If you are trying to change the constraints for any other subviews, please be sure to click with the mouse on the object in the view, and then on the constraints button.

Related

Fitting a tableView into its parent UIViewController

I dropped a TableView into my ViewController using Storyboard and I want it to be filled without any margins like the lower ViewController with TableView in the image below.
I tried some suggestions from the answers in other similar questions but didn't work at all.
Some say I need to set PIN. and I tried it like below:
I've typed '0' for all 4 constraints but this is what I got:
This AutoLayout thing makes me really hard to layout things automatically, unlike it's name.
What should I do now?
Just Click on Resolve Auto layout Issues after that click on Update frames as shown into below image.
In the Document Outline, tap the yellow arrow:
Tap the yellow triangle:
Then select Update Frames, Fix Misplacement.
This will fix the misplaced view. Alternatively you could have resized the table view before specifying the constraints.
I recommend you have a look at an auto layout tutorial, for example link.

Extra space on top and bottom of Init View Controller

I have a swift app I have been working on for some time now. I noticed that my init view controller has extra space at the top and the bottom of the view, so much that it allows me to pull up and down on the first view and let go and have it spring back into where it was. I removed all my constraints thinking I had an issue with them, but it's still done the same thing. The size class is set to any any, and all my graphic fit inside the view, yet I still an able to pull up and down.
I also made sure my view, wasn't a scroll view, it's not.
I looked around for similar issues, but couldn't find anything like this.
Thanks for the help!
Here is what my view looks like in IB
When I run the app.
Showing the amount I am able to pull it down from the top.
If you remove all of your constraints, and the storyboard is set to use auto layout, it usually won't show up correctly, as you have seen. You will have to add the constraints to each element in your view controller. To do that, you can control click on each and drag it where you want to connect a constraint. Or, use the pin and align buttons in the bottom right corner of the storyboard view.
There is a good tutorial from apple that I suggest you read. It will help you with the basics of using auto layout. Another option would be to not use auto layout. To turn it off in the Storyboard, go to the file inspector and uncheck the box "Use Auto Layout".

Interface Builder is not letting me delete a button

To clarify: I have a view/vc which is designed as an orphaned scene in IB in the storyboard it is used within. This view has a button with an image, a height and width constraint, a left and top constraint. There is a table below it with top, left, bottom, right constraints set to 0. A seperate VC loads this view, sets its width to half the screen and animates it coming in and sets its delegate.
All's honky dory. Now, we wanted to edit the sizing of the button and some miscellaneous things. I noticed the constraints seemed to not be getting applied in simulator. I then, after a while of playing with constraints and losing my mind, decided that maybe something more fundamentally wrong was occurring so i decided to delete the button and see where the table below it is getting placed with it's constraints set.
Then, nothing. The button is still there. I have looked to see if I accidentally c/ped it, and I have not. Is this a known bug?
Clean the project and delete the app on simulator.

Why isnt XCode 5 adding constraints in storyboard as I move views around using autolayout

My app was working and was ready for submit yesterday. I stupidly upgraded xcode. Some views needed adjustment. I got all but one working.
The one that isnt working is
View
Scrollview
Other child views
The problem is the scrollview doesnt scroll. User interaction is checked. I even recreated the entire view from scratch and relinked everything to my class.h and segweys.
I noticed that there are no constraints setup for this scrollview, or for any of the child views. When moving views around it no longer creates the purple, system constraints automatically. Before this I had converted the purple constraints to blue constraints and then linked them to the .h file so I could remove them and then apply my own constraints. But now, since there are none being generated I can't convert them to blue to remove. When I add them manually using the pin menu in story board, I get errors when navigating to that view in the simulator because of Prototype constraints generated at run time.
When I click on the view and hit Reset to Suggested constraints it doesnt add any...
How can I make xcode add the purple constraints automatically as I move views around?
I don't think there is a way to automatically add the constraints as you move the view around. If your view doesn't have any constraints, you should choose "Add Missing Constraints", not "Reset To Suggested Constraints"(this should add similar constraints to that you would have gotten automatically in Xcode 4.6). Once you've added the initial constraints, then when you move the view around, you can update the constraints to reflect your new position with "Update Constraints" or command-shift-equals.

ios - simulator looks different from the layout on the storyboard screen

I am having a strange situation. I created a very simple screen with some buttons on the storyboard, then when I ran the emulator (is it correct to say simulator or emulator?) it got the spacing wrong for one of the buttons.
I am adding a screenshot. The emulator is to the right of the storyboard screen.
Any idea why this may happen?
I thought it was a problem with the button. And it might have been. But when I took out two lower buttons, I got something even weirder as shown on this screenshot:
Thanks!
It looks like you are using Autolayout, and all your buttons except Investment has a Top constraint while Investment has a Bottom constraint, causing Investment's distance to bottom to stay the same when the screen grows taller.
Click on Investment button, click [Editor -> Pin -> Top space to Superview] in the top menu.
Click Investment button again. Click the second tab from the right in the right panel (the one where you can set frame). Look for a Top Space to Superview constraint, right click and delete. If there isn't one, then XCode did its job. Try running simulator again.
Edit: I just want to say that XCode has a habit of adding Top constraints for you when the view you just dragged into the xib is in the upper half of its container, and Bottom constraints when it's in the bottom half. I know XCode is trying to help but it drives me crazy sometimes.
It looks like you're using a 3.5" simulator and laying out for a 4" device, so the view will be resized.
If you're using autoresize masks, are some of the autoresize masks on your buttons incorrect? You probably want them all to stick to the top of the screen. Check to make sure the autosizing for each of your buttons matches this image. (You'll need to click the "ruler" icon to see these settings.)
I assume that you're using the XCode4 which provides NSAutoLayout as default. When you place an object to the storyboard NSAutolayout automatically creates constrains which layouts the object on the screen automatically for different devices(iPhone4,iPhone5) or orientations(portrait/landscape). Please check NSAutolayout class and constrains. if you want you can remove the NSAutolayout and your objects will be displayed on the simulator normal but in that case you have to manually adjust your objects for different orientations and screens
Hope helps.

Resources