ios - UICollectViewFlowLayout minimumInteritemSpacing fails after adding and removing another view controller -
ios - UICollectViewFlowLayout minimumInteritemSpacing fails after adding and removing another view controller -
summary
collection view shows 4 images. there more, they're not displayed yet.
animate view on top of collection. remove it.
come back. scroll uicollectionview display beyond original
they don't follow flowlayout rules.
details of work.
restart app.
go vc contains uicollectionview
do scroll show 5th , 6th items.
add vc on top of one:
[self addchildviewcontroller:formname]; [self.view addsubview:formname.view]; // build new frame. alter y position cgrect newframe = formname.view.frame; newframe.origin.y = 0; [uiview animatewithduration:1.0 animations:^ { formname.view.frame = newframe; }];
immediately remove view [uiview animatewithduration:1.0 animations:^
{ formname.view.frame = cgrectmake(0, self.scrollheight3,
self.screenwidth,self.scrollheight3); }
completion:^(bool finished) { [formname.view removefromsuperview]; [formname removefromparentviewcontroller]; }];
scroll uicollectionview. 5th , 6th entries still good. details of doesn't work
but, when 5th , 6th entries not displayed right away, happens:
restart app.
go vc contains uicollectionview
do not scroll show 5th , 6th item.
add vc on top of one:
immediately remove view
now scroll uicollectionview show 5th , 6th entries first time. new images not next rules. cells substantially larger flowlayout allows.
i have logged uicollectionviewflowlayout
parameters. unchanged. cell size unchanged. minimuminteritemspacing
still 12.0. i've spent couple hours on this. stuck.
i'm sorry don't have reputation post images.
here's how create cells:
uicollectionviewcell *cell=[collectionview dequeuereusablecellwithreuseidentifier:cellidentifier forindexpath:indexpath];
here's how create uicollectionview
photoframe = floor ((model.screenwidth - 3 * model.detailpadding)/2 - 1); verticalspacing = floor (model.screenwidth * 0.04f); flowlayout = [uicollectionviewflowlayout new]; // flowlayout.delegate = self; [flowlayout setitemsize:cgsizemake(photoframe, photoframe + 25.0)]; flowlayout.minimumlinespacing = verticalspacing; flowlayout.minimuminteritemspacing = model.detailpadding; [flowlayout setscrolldirection:uicollectionviewscrolldirectionvertical]; cgrect frame = cgrectmake (model.detailpadding, model.detailpadding, floor (model.screenwidth - 2 * model.detailpadding), floor (model.screenheight - model.navbarheight - model.topbarheight - 2* model.detailpadding)); // create info collection views tileview = [[uicollectionview alloc ] initwithframe:frame collectionviewlayout:flowlayout]; tileview.backgroundcolor = [uicolor whitecolor]; tileview.delegate = self; tileview.datasource = self; [tileview registerclass:[uicollectionviewcell class] forcellwithreuseidentifier:cellidentifier]; [self.view addsubview:tileview];
ios uicollectionview
Comments
Post a Comment