I need to display a spreadsheet in a view. There's no need to edit the cells of the spreadsheet, and the spreadsheet will consistently have the same number of rows and columns. (The spreadsheet cells will be populated with financial figures generated by the user in a different view)
How would I do this? A UITableView seems inadequate, as there need to be around 70-80 cells displayed in this table.
One way to do it is to write your own table cell to contain all the columns in a particular row. Then you can load the cell for each row in UITableView
If the cells don't need to be editable, they don't contain images, and the number of cells isn't large, you could just use labels or drawn text inside a grid of framed rectangles in a UIView, and display that larger view inside a UIScrollView.
Related
I have a project I'm working on with reports in MS Word that have similarly structured tables, but some of the cells are different colors depending on the report. To fill them in, I'm using a merge. I know I can format a cell or text based on the cell contents, but what about adjacent cells? I would like for cells to be shaded a light blue if the cells next to them have a specific text. Obviously this is easy in Excel, but is it possible in Word?
Can anyone help me with trying to figure out how to structure my code so I can enter in a value into one cell and have other cells calculate based on that cells value. For example, I want to have a static table view with 4 cells. The first cell being a total amount and the other 3 cells will automatically calculate when a user enters data into the 3 remaining cells. The data has to be dynamic. For example, if the total cell is equal to 12.00 and a user enters 2 into one of the three cells, the numbers 5 and 5 get placed in the other two cells automatically. I am think some kind of loop but can't figure out how to structure it.
You should use a UITableView with Prototype cells, not static, so you can reload it and have dynamic values in the text fields. If you want an example, let me know.
Instead of having table cells that takes the entire width of the screen, I would like to have square table cell, so that I can have maybe 3 or 4 table cells per line. The table cell would also change its size on the vertical dimension.
Is it possible ?
Thanks !
You should use UICollectionView instead of UITableView.
I would like to build a TableView where when the user clicks on a cell it expands to show more information. My question is how do I use Autolayout to arrange the multiple items in each cell.
Each cell will always be the same size, whether it is collapsed or not, so the sizing isn't dynamic.
The first problem I have is how to use Autolayout to arrange all the items in the cell. Before Xcode 7 I was successfully using Autolayout where I would pick a label-button-view to arrange, click Editor > Align > Trailing/Leading/Top Space, to.. etc. This is now greyed out and I don't know how to replace my old strategy.
Each cell has two rows of items. The first row shows all the time, the second only shows on collapse. Below is a picture of how the cell will look when it is collapsed:
The first row is a bit trickier because outlet1 and outlet 2 will have variable sizes. I would like 'label' to come right after label1, no matter how long or short that outlet happens to be. As arranged currently, there is a variable amount of space between the two.
What I'm looking to achieve in row 1 is basically exactly like Venmo:
Notice how 'paid' conforms to the size of the two names in the first row.
The second row has two buttons and an outlet which will always be the same size.
To sum up - how can I layout these elements in the UITableView for iphones4 thru 6S - and then how do I make this cell a collapsible cell? The construction of these cells seem to work as a system, not isolated from the whole - which is why this is a 2-part question.
is this what you want to achieve?
I'd like to use a UItableView to show a day Calendar. Each row corresponds to one hour. I need to show the hour between 2 cell of my tableview.
Like this :
(source: free.fr)
And this is my UITableViewCell :
(source: free.fr)
In the first screenshot, it works perfectly but if I scroll down then scroll up, my time label is cut like this :
(source: free.fr)
Have you any tips to figure out this problem using a tableView ?
The way you lay out your cell now is fragile, because the order of painting the cells on screen matters a lot. Try moving the content up so that your buttons are flush with the top of the cell, and the time label fits into the cell entirely. Add a thin header view to your table to make the top cell appear normal. Keeping the content of a cell entirely within its bounds should help you maintain reasonable scrolling speeds.
EDIT : You could also put a second clipped label at the top of your cell, and make its content identical to that of the label in the prior row. You would need to take special care to hide that label in the top row, but otherwise this should make your table immune to changes in the rendering order of its cells.
Make the background color of your cell clear. As you scroll up the z ordering of your cells get reversed and the lower cells overlap the higher ones causing this clipping.