IGListKit icon indicating copy to clipboard operation
IGListKit copied to clipboard

[enhancement] Capability of applying different inset or item/line spacing to every section controller of IGListStackedSectionController.

Open ShaneQi opened this issue 9 years ago • 4 comments

New issue checklist

General information

  • IGListKit version: 2.1.0
  • iOS version(s): 10.2
  • CocoaPods/Carthage version: 1.1.1
  • Xcode version: 8.2
  • Devices/Simulators affected: both
  • Reproducible in the demo project?: Yes
  • Related issues: None

===============

Let's say I have a stackedSectionController managing three section controllers:

...
let stackedSectionController = IGListStackedSectionController(sectionControllers: [
	SectionControllerAAA(),
	SectionControllerBBB(),
	SectionControllerCCC(),
	])
...

If I want to only give inset and line spacing to SectionControllerAAA.
The problem is: setting inset and line spacing in SectionControllerAAA's initializer does't work. Because it is managed by stackedSectionController (I assumed all cells of all three sub section controllers are combined into a single section controller).

So I set inset and line spacing to the stackedSectionController:

...
stackedSectionController?.inset = UIEdgeInsets(top: 5, left: 5, bottom: 5, right: 5)
stackedSectionController?.minimumLineSpacing = 5
...

But another problem would be:
Setting inset and line spacing on stackedSectionController would effects all the three section controllers (and top/bottom inset doesn't apply between different sub section controllers) which is obviously not what I want in this case.

So I suggest to enhance IGListKit with the capability of applying different inset or item/line spacing to every section controller of IGListStackedSectionController.

I haven't got a chance look into it yet, so that I don't have the idea how complicated this enhancement would be. If this suggestion makes sense to you guys, I will go ahead try to do this.

ShaneQi avatar Jan 26 '17 23:01 ShaneQi

I love this idea, but I think that w/out a heavily customized UICollectionViewLayout that is designed specifically to integrate w/ IGListKit, it'll be almost impossible. UICollectionViewFlowLayout only applies insets to the entire section. The new layout we're introducing in #449 also uses that logic.

We could look into extending the new layout w/ this, but atm I think it's going to be too complicated.

IMO if the sections need to behave that differently, I wonder if they belong in the stack in the first place?

@ShaneQi mind if we close this?

rnystrom avatar Jan 28 '17 08:01 rnystrom

@rnystrom I looked into source code a little bit earlier today, seems too complicated, not worthy. Also, my model is too complicated which makes layout complicated. I may need to simplify my model in the first place.

I agree we close this issue.
Thanks for the time!

ShaneQi avatar Jan 28 '17 08:01 ShaneQi

Hello guys, first of all - thanks for the great library! I want to raise this issue again Is there any way to make space between SectionControllers inside IGListStackedSectionController ?

denisenkoaj avatar Mar 21 '18 10:03 denisenkoaj

Unfortunately we're planning on deprecating IGListStackedSectionController (see #1099), but even if we weren't this would require a custom UICollectionViewLayout.

rnystrom avatar Mar 22 '18 01:03 rnystrom