Xcode bug? Cannot make UITableViewCell with "detail right" style in storyboard - ios

Please see the attached pictures. When I make a UITableViewCell in a storyboard and I select "detail right" as the cell's style, the label and text label are not visible.
I found that this is because Xcode is setting their font sizes to 0! While I can increase the size, I cannot change the labels' frames, which are also set to strangely small values, and so the text is truncated.
This problem does not appear with the other cell styles. The Xcode version is 5.0.2.
What is wrong here and how to I fix it?

I had the same issue earlier today. I fixed it by changing the font size from 0.0 to 17.0. I hope this helps.

This bug has resolved itself. The cause remains unknown.

Related

uitableviewcell corruption (saw from the bottom) on selection

I get this mini-horror sawtooth artifact at the bottom
of the cell on UITableViewCell selection
is there any cure?
ios version agnostic, happens on 9 and 10
both real devices and simulator
UPD: using first answer here: UITableView separator line disappears when selecting cells in iOS7
switching from blue selection style to style none masks this issue,
not sure if feedbackless cell selection style would be acceptable
for my employer though.
First check is height for your cell is correct or not.
If using autolayout and height is correct then verify the constraint for this label with proper hugging priority and compression resistance.
If using autolayout, also make sure you have set the preferredMaxLayoutWidth for your label
Also call layoutIfNeeded for your cell [cell layoutIfNeeded]
The minimal sufficient change to kill the artifact was to change
the default background for the label from default to white
to match the cell background.
In any event killing transparency fixed this, whatever that was.
A bug in GPU or GLES driver or higher up the stack. Whatever.
UPD20171024: closeViewAndMoveMapToPlase: is the culprit in another table.
This looks like a single symptom multiple causes issue.

UIStackView with UILabels in Xcode 7.3

Since I've updated to Xcode 7.3 I have a problem with UIStackView. If I create an empty project and just put two UILabels in UIStackView with default hugging and compression priorities, it shows me AutoLayout misplacement error. It even doesn't work with one(!) UILabel in UIStackView, so priorities doesn't matter (as I think, maybe there is the problem).
As I remember in Xcode prior 7.3 everything was fine. I checked on two MacBook Pro separately, it's the same issue.
Does anybody know how to fix it?
This is a bug appears in Xcode 7.3, so you can ignore it as what he said matt.
The problem
The storyboard can not calculate the intrinsic content size of subviews when you use UIStackView
Solution
If you hate seeing warnings in your storyboard you can fixe it like below :
You should do these steps for each subview of your UIStackView
Tap the warning of your subview
Tap "Update frames" option
Choose "Placeholder" of the subview intrinsic size in the fourth menu in the
inspector view
Like that you will not see warnings, and you can see if any ambiguities exist
The disadvantage is you should do this steps each time you change your subview (example: changing the size of text of an UILabel)
Hoping that Apple fixes this bug in the next release
Ignore the warnings. The storyboard has never quite understood stack views. The constraints will be correct at runtime and that's all that matters.
I have a different trick for eliminating the warnings and making 'update frames' work properly.
Advantage:
Doesn't require changing placeholder values every time text changes
Disadvantage:
Extra views that are unnecessary when Xcode 8 comes out
Steps:
Embed each UILabel inside a UIView.
Constrain the UIView to size itself based on the label (match leading, trailing, bottom, and top)
It seems like UIStackView (in Xcode 7) can't understand the intrinsic content size of a label, but CAN understand the intrinsic content size of a view - so put the label in a view and presto!

UILabel not respecting contraints after scrolling (label inside a xib, dequed as a uitableviewcell)

This is the craziest problem I've ever faced in iOS development. Basically I have a xib file:
This xib file is loaded as a row in a UITableView. In this xib file I have an UILabel ("Texto do comentário"), that is a multiline uilabel and will expand according to its content. To do so, I've added the following constraints and content hugging:
And all this actually works fine when I run and replace the content with a big text. This is how it looks like:
OK, now it begins the weird things, if I scroll up to the other cell (that uses the same xib file), the text view expanded its width and height in a way that doesn't respect my constraints:
Now if I scroll back to my cell that was working fine before, it has the same problem, the uilabel's width and height are not respecting my constraints anymore:
I've tried to inspect what actually happens to the constraints, if they are being ignored by some reason, and here is what I've found out. Both the constraints of my uilabel that has the right size and the ones in the uilabel that has the wrong size are the same.
I'm really starting to thing that this an iOS bug. Thank you in advance for your help
After trying, at least everything. The fix I found is to use UITextView instead of UILabel. This fix made me be sure that this is a UILabel bug.
I would say the problem you have is that you changes the Content Hugging Priority and Content Compression Resistance Priority values, which will make the UILabel not resize as you would expect.
You could try resetting the values to the default ones and if your other constraints are correct, the height of the label and of the cell should be calculated correctly.
Probably the UITextView worked because you did not change the default values for these properties.
Hope this helps.
This looks like another bug I previously encountered with self-sizing cells in a table view. Originally, I worked around it by explicitly setting the preferredMaxLayoutWidth of my cell's labels but I then discovered that sending an -updateConstraintsIfNeeded message to my cell in -tableView:cellForRowAtIndexPath: also worked around the issue without needing to set the preferredMaxLayoutWidth.
Hope this helps.

Xcode Label with long Text not properly shown

This is my first IOS app, just for training, and I got some issue with Label ,check the image
As you can See Object: Photo- Visualizing the Thomas Walther is not properly shown and some words are missing.
So How to fix it and make the string appears on multiLines if it's too long?
In your storyboard, select the UILabel and open the Attributes Inspector (in the utilities, which can be opened with the shortcut opt-command-4). You can change all the the basic properties of the UILabel here.
For multiple lines, ensure that the label height is large enough and set the Lines to 0. You can also change the font scaling in the Autoshrink property (default is fixed font size).
I can't really tell from your screenshot, but you may have some Auto Layout issues with the width of your label to the right side of the window. So you may want to look into setting Auto Layout constraints as well.

UITableViewCell wrong height in initial display

This isn'an a question, just a results log on an issue I had with XCode 4.5 storyboards and dynamic height UITableCell with a UILabel.
The issue was; the initial display of a cell would only show part of the resized UILabel contents, and that the visual UILabel was not resized. It would only display correctly after scrolling off the top of the Table and back down.
I did the calculations in hieghtForRowAtIndexPath and sizeToFit the UILabel in rowAtIndexPath. The sizes where coming up ok in debug, but the device was not updating the display with the correct size and UILable.text value.
I had created the dynamic UITableCell in a storyboard. However, I had set the width and height to a nominal value (290x44). It turns out, this was causing my issues.
I set the width and height to zero (0) in the story board, and everything started working correctly. (i.e. the UILabels displayed at the correct size with full content).
I was unable to find anything online on this issue, except for some references to creating the custom table cell with a frame of zero. Turns out, that was really the answer (for me).
I ran into the same problem and solved it by simply unchecking "Use Autolayout" in storyboard. You might want to give it a try.
I was unable to find anything online on this issue, except for some references to creating the custom table cell with a frame of zero. Turns out, that was really the answer (for me).

Resources