I have a UITable with custom TableView cells.
The cell's contents are based on the segmented control ("Upcoming/Settled").
I have posted a screenshot with three images.
The first shows the cell as soon as the app is loaded. Next to the flame, it should have a number (100219). However, because the text on the left is very long, for some reason I the number is not drawn.
If I change the segmented control index, and bring some new cells (that have shorter-length text), the number appears.
Now, If I switch back to the cell with the long name I get the expected effect which is the name being shrinked to fit and the number drawn as well.
Any ideas how to get this to work as soon as the app is loaded?
Link to image that shows the issue:
UITableViewCell - Autolayout - Label
Related
I am loading different components in the tableview. Each component is having different types of data such as video, image, quick reply and other component.
I am able to load all the data and added to the table view and table view height is adjusted based on the data response.
Now my requirement would be one specific component is displayed at the bottom of the screen always. How do I change the Y position of the particular component?
The problem which I am facing now, not able to change the position of that component.
You can use another UIView fixed at the bottom of the screen below your tableView. You can put that component in that UIView. This way it will be fixed at the bottom.
Another option is using a TableViewController instead of a TableView. That way you can have static cells. You can set the last cell at the bottom however you like. It never changes.
I am using a UITableViewController with static cells, as a user details form. Everything works, until I tap in one of the cells's text field, the keyboard (or custom inputView) shows up, and you scroll the table down. Cells are then not shown, instead a blank space is shown. Scrolling up and back down then correctly shows them.
If I scroll the tableview down until the "geboortedatum" field shows up,
and press on that textfield, a custom inputView with a date picker shows up:
Now, if I scroll the tableview down, the next rows show up blank:
Two rows are supposed to show up there, like this:
It's not related to the inputView with the date picker, the same happens when the plain old keyboard shows up and you scroll the table down.
I have not overridden any of the tableview delegate or datasource methods apart from showing custom headers (but the problem is the same when I remove that), and am not using UITableViewCell subclasses, just static cells in a storyboard. It seems like an iOS bug to me, but is there any way to work around this?
I think I found the cause and the solution. The problem is that these last 2 cells don't actually fit in the storyboard design:
They are there of course, just not visible by default. If I change the storyboard to freeform with a custom height to make it all fit, like this:
Then the problem doesn't show up anymore. The cells are not hidden anymore on scroll, as before. Very strange.
I will have a number of cells (typically 5-6), and I want a text view underneath it. But I want the position of the text view to change based on the y-value of the lowest cell.
That way, no matter how many cells, the text view will be directly under the cells.
I tried placing the textview within the tableview, but it hid the cells.
Not sure what else to do.
you could for example set it as the tableFooterView...
(see https://developer.apple.com/reference/uikit/uitableview/1614976-tablefooterview)
I am building an application where I have a ruler (that is a UIImage) that I use to scroll a UITableView. My UITableView has UILabels on each cell that display text. When the user leaves the ruler over a cell, the ruler has on it a UILabel that displays the contents of the UITableViewCell that it is over top of. All of this functionality is in place, and is working fine.
What I would like to do is when I scroll the ruler up or down, is to be able to view the contents of the table rows behind it dynamically while "the ruler is moving", so that the user can see right through the ruler. As a concept, I realize that this technique is called "masking", but normally "masking" is done using two images. What I'm trying to do is use a UIImage that has a UILabel on top of it, to display the contents of the rows behind it while it is moving. Can anyone show me how to do this, or point me in the right direction?
Here is an image of what it is I am trying to implement:
If you look at the image that I am using, the ruler image is partially hiding the bottom of the text in the third row, and partially hiding the top of the text in the fourth row. I would like the ruler to display the bottom of the text in row 3, and the top of the text in row 4 rather than hiding it when it is in this transition state.
I'm using a prototype cell inside a grouped UITableView to create custom cells with two UILabels inside. Each UILabel is populated with text. The first UILabel, alligned on the left of the cell, behaves appropriately.
However, the second UILabel, which is toward the middle of the cell, is somehow being drawn behind the cell's background! I can't explain why, but if I set the background color of the cell to be clearColor instead of the default, the 2nd Label can be seen and works just fine. It also shows up if I highlight the cell, but disappears again when unhighlighted. I am sure that the label isn't just "blending in" with the background; the background is white and the label is black.
Any ideas? I'm a bit stumped. Is there some sort of issue with prototype cells and having more than one label?
Edit: Answered my own question, see below.
Okay, this has been resolved!
So like I said, I was setting up prototype cells in interface builder with two UILabels. To access these UILabels in my cellForRowAtIndexPath delegate method for my UITableView, I was using the Label's Tags. The first label I had tagged as "1", and the second label tagged as "3" (don't ask why it is 3 and not 2). Anyway though, it turns out that UITableViewCells already have a label with special properties setup with tag 1. Besides the label with tag 1 hiding my 2nd label, it was also remaining centered in the cell when I was changing cell size dynamically (when I wanted it to stay at the top).
Long story short: UITableViewCells have a "special" label already built in with tag of 1, so I changed my first label's tag to 10 and everything went back to behaving as I would expect.