Can't add missing constraints Xcode 6 - ios

I have just finished an app which I will only be releasing on the iPhone, no iPads. Clearly there are different sized iPhones so I had to fix up a few layout issues in my project.
Apparently a nice way to approach this is to simply select the views and 'add missing constraints'.
When doing this I get the following error message:
I have tried clearing the constraints, but no look.
When I click 'reveal diagnostics in finder' I am directed to zip file named 'IB-layout-diagnostics_2015-07-08_13-57-41_336000' containing log files and simply can't decrypt it.
Has it something to do with the fact that I have the app completed, and am accessing some of the views programatically in Swift?
In the development info I have the device set to iPhone, the device orientation to Portrait, and I have 'Use Auto Layout' and 'Size Classes' checked.
Any ideas why I'm getting this error? Thanks in advance.

This answer may not be specific enough. But if anyone else is having the same problem this is the solution I found:
Copy all views from inside the Table View Cell, into some other temporary View Controller
Delete all views from Table View Cell
Select all Views in Controller and add missing constraints (Works now!)
Add views back to Table View Cell
If anyone has an alternative solution which can be explained to me, feel free to answer or edit this one. Thanks.

Related

UITableViewCell's contents disappear when app run in simulator

UITableViewCell shows up in Main.storyboard but doesn't show up in simulator.
I'm using Main.storyboard. In my simple experiment with Swift, I added a TableView, then put a UITableViewCell in it, and then I put an image and a label under the cell's content. It looks okay in Main.storyboard but when I run the project, the content disappear. All I did is purely on Main.storyboard and not touching the .swift file yet.
Here are the links of screenshots of my simple work:
How my app looks in Main.storyboard
How it looks when I run Xcode simulator on iPhone 8, the tableview cell's content disappear
I have searched the problem through the stackoverflow and found a related question here: 'UIImageView doesn't show up in simulator', then I followed the recommended solutions from the forum but still didn't solve the bug.
What I have done so far to solve the bug:
Check if every item in my view has four constraints defining X, Y position, width and height.
Try to check and uncheck the autolayout flag for my Main.storyboard
Make sure my tableview cell's contents (and everything inside my view) has alpha set to 1
Well I haven't check how things looks in my .xib file.
I would like to know if this is a bug, or just a problem in my settings?
I'm quite new to Xcode, swift, and iOS app. Any help or suggestion would be greatly appreciated. If you have the same problem with me, I would like to know your case as well.
The only reason your cell doesn't show up in the simulator is because your tableview is dynamic.
Dynamic table views have data that is loaded at runtime, where there isn't a fixed number of cells, and every cell has the same layout. The Apple tutorial is a good place to start. It guides you through on how to use a tableview/tableviewcontroller.
There is no way around it: You have to code in .swift files if you want to use dynamic table views.
If you are going to use static table views, on the other hand, the number of cells is fixed, and the data is not loaded at runtime. You can use static tableviews if you don't want anything to do with code at the moment.
I had a similar problem. I solved it by deleting constraints for the affected view and starting all over.

Issue loading storyboard in interface builder

I am building an app in Xcode 7.3.1 and it runs on devices and the simulator just fine, displaying the cells in my collection view.. but in interface builder the collection view cells do not appear..
I can't state how to recreate this scenario as it seemed to bug out like this after some changes I made in code a while ago.. before that it was displaying in interface builder just fine!
There should be two prototype collectionViewCells displaying on the view controller scene.
From my research it seems to be a documented visual bug but I have not yet found a solution to it.
No amount of 'cleaning/building' and closing and reopening the xcode project seems to fix this..
SOLVED!!
The answer, as described in this SO answer, is that the collectionview and its respective attributes did not have their appropriate size classes installed.
This is evident by the fact that the collectionview and labels in the screenshot below are greyed out.
Using the advice from the SO link I solved my problem by selecting each greyed out component and then making sure that I ticked the top box labelled 'installed' in the attribute inspector.
After doing this and remaking the constraints my storyboard was back to normal!

xcode 6 copy views from older projects

I created a new Xcode6 project and things were great.. but then I copies a few view controllers from an old project over. Now those views have an odd black bar appearing at the bottom of the view when I run the app on a device or in the simulator. Its transparent on some devices and not on others. They all have "bottom bar" set to none.
I tested this out by re-creating one of the views and the bar is gone. has anyone run into this before? If so, is there a setting to change to fix it? I have been looking through the source code version of my storyboard and see nothing that will help. Its not any constraints I have set because 1 of the views is nothing but basic tableView with no changes or outlets.
I know the "solution" is to recreate all views I copied over. However, I spent a great deal of time on setting each individual subviews constraints on a particular view controller. So if I am missing some simple setting my time wont be wasted re-setting up this VC.
Thanks for any help given :)

Why don't my views show up in Storyboards and are greyed out in the left pane?

I am experiencing a weird bug in Storyboards.
I set up a UITableViewController with prototype cells and set some autolayout constraints. Everything fine until here.
Then, I had to move the whole project directory into another folder. This is a normal action I believe that shouldn't lead to any problems since the app and all the files are pretty much self-contained.
However, since I moved the project, the prototype cells in the UITableView are shown empty within my Storyboard, but the subviews are still showing up in the left pane where all the scenes and views are shown... Only that they are greyed out (see the screenshot)... Does anyone know what this means? I also looked into the XML of the Storyboard file, but everything seemed normal to me in there...
Any ideas?
EDIT: Strange thing also is that the IBOutlets from the custom classes still are set and link to the views in the storyboard... but only in the left pane, not in the storyboard itself.
Just found an answer myself, it was because Size Classes were reset after I moved the project...
Greying out views is Xcode's standard behaviour when the views are only set for a specific size class which is currently not selected!
I had set the size classes for my UIViewController to Compact - Any, this is what it looks like in proper state:
The problem occurs when I change the size classes to another one (e.g. Any - Any):
This happened to me because I copy and pasted some of my views from nib into storybaord. Turning size classes off, and turning it back on fixed the issue. This can be done in File inspector, using a checkbox named Use Size Classes

iOS - dependent constraints console output with autolayout

I am making an iOS app that uses popovers on several occasions. I get the following output message to the console every time one specific popover is dismissed (but not when any of the other popovers are dismissed):
All dependent constraints should have been removed from the engine and also from the view's list of dependent constraints
I have searched Google and this site for that phrase and nothing has come up. I am not sure why it would happen for only one popover and not others. Would it have something to do with its view controller? The popover itself? I am an autolayout novice, so there may be something simple I'm missing. Any ideas?
I too had this issue i solved it by removing the Use AutoLayout checkbox from the XIB, the auto layout XIB is present in the file inspector option.
Hope this helps

Resources