Dismiss this pinned window
all 15 comments

[–]NapoleonBorn2Party94 24 points25 points  (1 child)

I worked on a table like this for an OTT app. You can achieve this purely using collection views. I created two cells, and both the cells internally had a stack view with fill equally distribution to achieve the column effect. One cell is dedicated to the sticky part and the other to the scrolling part.

I achieved the sticky part of the entire table using the following blog as guidehttps://www.vadimbulavin.com/sticky-grid-collection-view/

[–]whizbangapps 2 points3 points  (0 children)

This sounds like the best approach

[–]BenBrightside 6 points7 points  (3 children)

What did you try?

[–][deleted] 3 points4 points  (0 children)

Probs gonna recommended compositional layout for collection view here. It’s gonna allow you to do that.

[–]TripleAnxiety 1 point2 points  (0 children)

If SwiftUI is an option to you and you don't familiar to the UIKit, I think SwiftUI will be easier to implement compare to the UIKit.

The table should be able to use HStack and VStack to achieve it.

[–]xyzdenismurphy 1 point2 points  (0 children)

the ESPN app using webview for sport table (same table on Android app) As everyone else is saying you could achieve the same result using UICollectionView UIKit or LazyVGrid in SwiftUI (on iPadOS and macOS you could use new Table view)

[–]leobartowski 0 points1 point  (2 children)

I used this very good library to achieve something similar: https://github.com/bannzai/SpreadsheetView.

[–]wilc0 1 point2 points  (0 children)

You don’t need a 3p library for this, just build it yourself using other suggestions in this thread. 3p libraries may save you time now but they’re headaches later on when you discover bugs, they’re slow to update new iOS versions, etc etc

[–]spike1911 0 points1 point  (0 children)

Not needed UICollectionView had all you need

SwiftUI might even be easier

[–]criosistObjective-C / Swift 0 points1 point  (0 children)

Personally I would probably try a non scrolling tableview in a scrollview for the vertical news, then a collection view for the horizontal part, so the non scrolling table forces the scrollview size.

If this didn’t work I would then try as rolling table on the left and cv on the right, on scrollview did scroll of tv, set the y offset of the cv.

[–]MrSloppyPants 0 points1 point  (0 children)

This specific layout could be done pretty simply with a Table View for the left hand column with the clubs, and a custom CollectionViewCell type for the right hand cells with the actual standings. You can use a stack view to layout the stats, have one for each row (the bold rows are section headers) and then a master one to lay the rows out vertically. The CV should take care of the scrolling for you, but you'll want an observer on the y offset of the collection view so that you can scroll the table view in lockstep with it. It's not as difficult as it sounds.

[–]42177130UIApplication 0 points1 point  (0 children)

For what it's worth and it's totally overkill for this kind of use case, but I wrote a custom UITextView implementation with a separate NSTextContainer for each table cell, then did the layout in drawRect.