UITableView sections to always stay within view - ios

I have a UITableView with 3 sections:
section 1:
the header title of this section is "Players" and the cotent is exactly 1 cell containing a horizontal list of 1-4 players names.
section 2:
the header title of this section is "Rounds" and the content is X cells each containing a horizontal list of each respective players score for round X.
section 3:
the header title of this section is "Totals" and the content is exactly 1 cell containing the sum of each player's round scores.
Right now, all these sections scroll as section 2 expands with new rounds, but I want to always keep section 1 at the top of the screen, and have section 3 right below section 2, until it expands down to the bottom of the screen and then stop and stay there.
I guess I could do this with 3 separate table views inside a UIView but that seems kind of convoluted and I section 3 wouldn't stay right below section 2 until it expanded to the bottom of the screen; it would just always be at the bottom...
Is there a way to keep a table section/row always visible, and have the others still scrollable?

Use 3 UITableViews as you discussed, and just animate the position of the Third tableview to move it down each time you add a cell to tableView 2, until it reaches the bottom of the screen then just leave it there. (Also you will need to expand the height of tableView 2 as you add elements to it.)
Otherwise, like Cyrille said, there is no way to implement that with one tableview only.

Not with the standard UITableView implementation, no.

Related

Layout problem in UICollectionView when reloading

I am using an UICollectionView to display a list of items in a 2 column layout with equal size of columns. This is obtained by a flow-layout.
Simple.
However, the first row is different from the rest, as it can vary from being full "screen" width or two column width. In continuation hereof, the collection view displays two types of cells (A and B). A is always displayed with full "screen" width in first row and B cells always in columns of two.
An option button can switch displaying type A cell or not.
All this can be brought to work with a flow-layout and proper width sizing of the items through delegates.
Unfortunately, when switching between not displaying type A cell with full width and displaying type A cell, an visual disturbance occur, because the collection view calls first delegate with "sizeForItem" and then collection view calls delegate "cellForItem":
collectionView(_:layout:sizeForItemAt:)
collectionView(_:cellForItemAt:)
This means that the "old" B cell in first row is being displayed with full width for about 1 second or less. Which does not look good.
Difficult to see any solution to this.
Hope someone can.
Below, three images shows how cell B is temporarily being shown with full width before cell A is being shown.

UITableView with Horizontally wrapping cells

I am looking for how to, in Swift and Interface Builder, create a UITableView in Xcode where the table has a set width (example: padding to left and right edges of superview might be 8). In the table, I want cells to go across the first row. When a new cell can no longer fit in the first row I want it to go to the second row. When a new cell can no longer fit on the second row, I want it to go to the third row, etc. I only want the table to scroll vertically.
If anyone can point me to examples or documentation on this I would greatly appreciate it.
You are looking for UICollectionView.
http://www.raywenderlich.com/78550/beginning-ios-collection-views-swift-part-1
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionView_class/

Shows bottom section of table view at visible view

I know the title is confusing. So I explain what I expect.
I have 3 sections in my table view. The first section has one or more rows. And second and third sections has only one row. When the first section has more than 4 rows the next sections going to be visible by scrolling table view bottom.
But I need these sections be visible in this case.
Actually I need show these sections at the bottom of the visible frame when first section has more than 4 rows!
Is it possible ?
The thing you can do it to display only the 3 first rows of the first section and then when the user starts scrolling, you add the additional cells to the first section while he is scrolling until you've added all of your cell.
Do the opposite when scrolling to top.
You can use two different TableView instead of one.
declare first TableView with only one section & seconds TableView with two section with one row each.
for that you need to use UIViewController instead of UITableViewController.
in this way your bottom TableView Cell always stay visible while first TableView can scroll with more cells.

UITableView Section Header Stay Anchored for All Sections

I have a UITableView with many sections. It is a simple table view. I am using viewForHeaderInSection to create custom views for these headers. So far, so good.
The default scrolling behavior is that when a section is encountered, the section header stays anchored below the Nav bar, until the next section scrolls into view.
My question is this: can I change the default behavior so that the first section header stay anchored at the top for all sections?
Thanks.
Desired Behavior image url:
https://www.dropbox.com/s/2lnspddx02aku1n/scroll.png?dl=0
I've done this by augmenting the header/data relationship. You can have a section header on even numbered sections, and data in odd numbered sections.
Example: For section 0, you can show the appropriate heading, but have 0 rows in that section. The data for section 0 should show up in section 1. Section 1 will not have a header. etc etc.

custom uitableview section design

I would like to have a custom section design for my app.
The particular case would be to have a text displayed on the left of the section elements.
Could someone help? i've attached a image to better explain what i mean.
UPDATE 1
Let me elaborate: I would like to have a uitableview with N number of sections, each with variable number of elements per section. For each section, i would like to have a description on the left of the rows. The scroll show act as in any other uitableview.
You must have a table view, in each cell in the left side add a label and on the right side add a new tableview.

Resources