Issue loading storyboard in interface builder - ios

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!

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.

Custom TableViewCell contents invisible on iOS9 (Xcode7)

since the upgrade to Xcode 7 & testing my app with iOS9, the contents of some custom cells have become invisible at runtime. There's an emphasis on 'some' here, as this affects only 2 out of 6 table views, all of which reside in different view controllers.
A similar problem was encountered here, but the answer ("check constraints") does not work for me:
Custom TableViewCell contents invisible on ios9 xcode7
The cell that makes trouble is a large placeholder that is displayed when no data is available to be presented in the table.
It only contains a UILabel which is centered by two constraints.
The cell, as well as other custom cells not shown in the picture, are visible at runtime. However, not their contents.
In other view controllers of the same app, the exact same custom cell (same design, same class, same reuse identifier...) work as they should.
However, not in this VC.
Before the upgrade to Xcode 7 and testing on iOS9, the cell's content was visible also in this VC.
I haven't changed anything in IB or the code and double-checked everything a couple times. It's crazy and I am desperately looking for help :-)
Thanks for your time
In the meantime I figured out the answer:
In iOS 8.4, the label is installed in the view hierarchy, whereas it isn't in iOS 9.2 according to XCode's view debugger.
The size class for the label is Regular/Regular, which should suffice for iPad.
When I add the size class Any/Any for the label, it will install correctly.
This is clearly a bug which has been confirmed to my by Apple, but not acted upon yet.

Interface Builder Objects not visible in my storyboard (and titles are transparent)

I am using the same version of XCode as another developer I am working with but when I open the project on my machine the interface objects are not visible in the storyboard and their names are semi-transparent. I’ve Googled around but I cannot seem to figure out why this might be happening.
Any ideas would be much appreciated!
It's because the views have been set for a different size class in Interface Builder, and not Any & Any, which you have currently selected.
Just change the size class in the interface builder appropriately and the views will be back! :)
I encountered the same issue, read more here: Why don't my views show up in Storyboards and are greyed out in the left pane?

Cell content of a Table View that is part of UISplitView is not being rendered

Here is some background to the issue. I've been looking at it for the past two days and to my knowledge everything is properly configured. To make sure that we are on the same page with versions that are being used I am using the following:
Xcode 6.1
Code is in Swift with some added Objective-C libraries
OS X is 10.9.5
I have UISplitView that was added to the storyboard at a later stage of the project. The project was started form Single View template. Normally the left part consist of a UITableView. When Xcode added it to my storyboard it also had a prototype cell setup. I've added the needed Identifiers and now the prototype cell is accessible in my code. I've implemented and binded the needed delegate and dataSource protocols and checked that their methods are actually being called and working. I've also added background colors to the prototype cell and the prototype label and I see a cell when there should be one but it does not have a label. So here is a list what I've checked:
Data binding is working and data is available. I've also cross checked this with a second UITableView that is in the project and is working properly. This is also true because I see the background color that was set for the cell when I run the app and data is available;
The storyboard does not have any errors or warnings. In fact the project itself does not have any warnings on compilation;
I've reset/removed/recreated constraints multiple times;
I've used the Preview mode and I can see the label rendered properly on my target device and orientation. I've checked this because storyboard sizing can be easily overseen so that you actually don't have the label for this device and orientation but this is not the case;
I've used the new layout debug feature that Apple added in Xcode 6 called view debugger and it does not show a label for this cell. And on the following screen shot you can see that the background of the cell has been properly rendered but there is nothing that is on top of this cell. The cell has been selected for better clarity.
So pretty much I am out of ideas right now. Can you please help me on revealing this mystery?
To answer my own question.
I've created an empty master detail project and saw that this is working there. This made me think that actually there is some kind of a bug in Xcode when you drag and drop an UISplitViewController to your storyboard. For some reason the storyboard is not properly configured. I have no idea what is not properly configured but there is definitely something that is wrong.
Because of the above observations I deleted the UISPlitViewController and used a plain UIViewController to recreate a similar setup that will also work for me. As a result I was able to adjust my already existing code to the new View and use it without logic changes. Which to me just indicates that this is an Xcode issue.
Thanks!

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

Resources