Static UITableViewCell blank - Swift, iOS 8 - ios

I am trying to implement some static cells in a UITableView using Xcode 6 beta 2 and Swift. I have successfully implemented dynamic cells.
When the user clicks on one of the dynamic cells there is a push segue to a new UITableViewController for a UITableView with static cells.
I have set this all up in Xcode and the segue works but when I drag a UILabel onto one of the static cells it just doesn't show up at run time. A few things that might help narrow down whats going on:
The data source methods are not being implemented in the UITableViewController
If I set the background of one of the static cells to a particular color, that shows up at run time
Any advice much appreciated.
Thanks in advance

I "fixed" the issue creating a new storyboard...
On a clean project it was working, maybe it's a bug?

I believe this is the answer here:
https://stackoverflow.com/a/24708004/3827274
TLDR: it's an Xcode bug with changing the view to 'compact' width which seems to only affect alignment/positioning. Click on your UILabel inside the cell and go to the inspector all the way to the bottom and play with the 'Installed' or note if the default one is disabled.

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.

Adding Static Cells to UITableView in Interface Builder for iOS8? Content Section Not Shown

I am trying to add static cells to a UITableView in XCode 6 using Interface Builder. All the tutorials I am seeing online show a section called "Content" which allows the cells to be made static. Also, there is a feature to switch the number of sections.
I have screenshots below for both.
This is the first, with the feature:
This is the second, without the feature:
I could probably figure this out, but I'm wondering why the problem is happening. The one with the feature is from an older version of iOS and is placed inside a storyboard. The one without the feature is from the newest version of iOS and XCode, and is in a .xib file, without a view controller in the file.
I'm thinking this may be an issue with the new XCode, but I'd love to hear why. I'm really needing to make these static cells, and all the answers I've found on the internet seem to assume that this section is available.
Dynamic prototype and static cells are only available in storyboard table views.
Static table view cells are only available when using storyboards. However, if you aren't using storyboards for your entire UI you can still use them for individual screens instead of a collection of screens.
Please see this link.
https://stackoverflow.com/a/11041693/3683148

Xcode/iOS-Cannot edit content of Table View Cell...I'm using the storyboard editor

Hey guys this is my first question here on stackoverflow, but I've been browsing for quite some time.
I'm kind of new to iOS programming, but I feel like I'm getting the hang of it though.
I ran into this one issue today that just has me stuck though. I have a tableview with 8 prototype cells in it, and everything was working fine with them, then I realized I needed more cells. I add another cell, but then I found I couldn't resize the contents of the newly created cells. I don't think it's an issue with just my project because I just downloaded a tutorial that uses a tableview and I ran into the same issue.
Here are some pictures to show my issue: (I can't post images so here are the links)
Size inspector for one of the new cells:
What happens when I click on the label in one of the original cells:
What happens when I click on the label in one of the new cells:
Has anyone had this issue before?
What could it be?
Thanks!
![enter image description here][1]Got it, the cell you used is auto layout, do not check the auto layout in the xib or storyboard!
Interface Builder Document->Use Auto Layout Don't check it!

Incorrect UISwitch appearance in UITableViewCell

I created a sectioned UITableView and added a custom cell that includes a UISwitch. All this is done using the storyboard. However, when running the App (Simulator/device), the UISwitch does not look as expected (c.f. attached screenshot).
Any ideas on why this happened are highly appreciated (XCode 4.5.2, iOS 6.0.1). Note: creating a new UIStoryboard does not solve the problem.
I just got the answer to my question: I created a category on UIImageView that sets custom layer properties (e.g. shadowRadius). Setting a breakpoint on the corresponding UIImageView method, it revealed that the UISwitch called it.
I did not get to this point earlier, as I only had a single UIImageView before (and this one was supposed to have custom properties). Thanks for all your comments!

Custom UITableViewCell class in Xcode 4.2

I've been following this Apple Doc to add a custom UITableViewCell that I layed out in an .xib to my project. One problem with the doc is that it seems like it was written for an older version of Xcode.
I'm able to load my UITableViewController that the custom cells are on, but the cells are all blank. My custom cell contains several UILabels, and has a non-default background color. The table that appears when I run has the default white background and no labels. If I change the UITableView's View -> Background on my storyboard, the color of the cells' background changes, but the labels still don't appear.
Of interest is the fact that the data is still in my table's cells. The UITableViewController is itself called as a popover from another controller. When I select one of the cells, the strings from the various label.texts are supposed to be loaded into their own labels on the popover's delegate, and that code works fine (except when I try to include a UINavigationBar in my popover, but that's probably another issue entirely).
I'm still pretty new to iOS developement, so if there's anything I'm leaving out or being unclear about let me know.
Edit - cleaned up code, now is completely different question than when I originally posted, but is still on the same topic. Should I have deleted the old question and posted this as a new question all together, or is it alright that I just edited it?
I'm still not entirely sure what was wrong with what I was doing before, but I managed to get what I wanted. I originally dropped a UITableViewController onto my storyboard set up a popover segue (also on the storyboard) and tried to display the popover with performSegueWithIdentifier. Instead, I now create the popover completely in my code (which I found a nice tutorial for here on SO, by goggling "show popover programmaticly"), without having anything for it on my storyboard. That seems to be the most documented and stable way to show a popover. Once I displayed it that way, my custom cells showed up exactly like I wanted.

Resources