Iglistkit: how to set the linespacing of items in the first level

Created on 15 Dec 2016  路  5Comments  路  Source: Instagram/IGListKit

New issue checklist

General information

how to set minimumLineSpacing and inset of the main view?

see the picture:
a0519489-e3cb-46eb-9a1e-1d147366897f

I can set those in a IGListSectionController, use

- (instancetype)init {
    if((self = [super init])) {
        self.minimumInteritemSpacing = 10;
        self.minimumLineSpacing = 10;
        self.inset = UIEdgeInsetsFromString(@"{10,10,10,10}");
        self.supplementaryViewSource = self;
    }
    return self;
}

but it's only affect items in this section, I want to the whole section can have original linespacing property to set but can find where to set.

my demo datasource:

[
 [1],
 [2],
 [1,2,3,...9]
]

I want to have 3 main block,
the 3 main block have a 15pt line spacing, and 10pt inset to main window's view
and the third block have 3*3 item.

the third block is ok, I can set the sectionControllers lineSpacing and interItemSpacing, but the main block's line spacing I can't find how to set.
I can only use a * supplementary* to simulate a spacing, but I'm sure it's not designed for this.

From your example, I found that the "EmptyViewController" look's like what I need, but it's by setting a inset to accomplish this , and I now use this way. is there an original way to use line spacing in first level cells? since the first level cells it's also implement by a flowlayout

question

Most helpful comment

@walkerwzy minimumLineSpacing and minimumInteritemSpacing control the spacing between items in a single section. If you want to control spacing between sections (and the containing collection view) you should use the inset property. Right now you have 10,10,10,10, so each section will be inset by 10 points in all directions (which means there is 20 points of vertical space between sections).

Does that make sense?

Also thanks for providing the mockup! Super helpful. I updated it to call out what I mean by insets.

image

All 5 comments

I'm an IGListKit noob, but I think supplementary with a section header of 10px is the way to go. From what I understand EmptyViewController is used when there are no objects in your ListAdapter.

@walkerwzy having a little trouble following the exact setup you're trying to achieve. Do you have a mockup or anything to look at?

It sounds like you want more separation between section controllers, is that correct? If so, what about adding more padding to the bottom of your inset? Using something like UIEdgeInsetsFromString(@"{10,10,10,20}")?

@jameswasher EmptyViewController which I mentioned is that it's UI is what I need, not the usage scenario :)

@rnystrom ok, I've update the issue and upload a picture to illustrate the question.
and yes, I now use padding for each section controller itself, I ask this question is that, since the first level sections it's also a collection view use flow layout, why can't we custom it's separation and it's original supported by flow layout

@walkerwzy minimumLineSpacing and minimumInteritemSpacing control the spacing between items in a single section. If you want to control spacing between sections (and the containing collection view) you should use the inset property. Right now you have 10,10,10,10, so each section will be inset by 10 points in all directions (which means there is 20 points of vertical space between sections).

Does that make sense?

Also thanks for providing the mockup! Super helpful. I updated it to call out what I mean by insets.

image

I probably know what's your design purpose, everything it's on section its own, including the separation between sections

Was this page helpful?
0 / 5 - 0 ratings