ios - UICollectionView hiding my supplementary view, why? -


So I am creating a UISegmentedControl , which I'm putting in a supplemental view for archiving Am I Rai I am then using a fragmented control on it through a representative on my UICollectionViewController , which appropriately sets a BOOL type property on the changes in data being sent out of a stream To IBAction , other to It all starts to work, like when I tap on the second tab after loading the archive tab (which loads with the first tab, and the right data for the first tab), the correct data is displayed, but My supplementary view goes away! (UICollectionView *) collectionView layout: (UICollectionViewLayout *) collectionViewLayout referenceSizeForHeaderInSection: (NSInteger) section

 :  

It's funny>

This method is being called properly, and I am setting the size of my supplemental view properly, and I can see in my simulator because my data is in the shape of my supplemental view Is offset. (UICollectionView *) collectionView viewForSupplementaryElementOfKind: (NSString *) Type atIndexPath: (NSIndexPath *) indexPath

 : What is not being called, however, this method  

This method is called only when my collection view loads, thus the controller with the initial section is loaded, but never called again, Even if I'm calling reloadData on collectionView, the above mentioned method is again Called.

To add another twist now, I went through and applied a breakpoint to one of the ways to reload the archive scene, and did it:

  Po [self.view recursiveDescription]  

In the debugger, to know that the controller view in my segment is still present, and this is it! This is a hidden flag, set to Yes, though ...

  baseClass = UICollectionReusableView; Frame = (0; 320 55); Hidden = yes; Layer = & lt; CALayer: 0xef4bd30 & gt;  

How do I get this view to be hidden, when I have only one reference that is called the method:

  - (UICollectionReusableView *) collectionView: (UICollectionView *) collectionView viewForSupplementaryElementOfKind: (NSString *) type atIndexPath: (NSIndexPath *) indexPath  

and this method is not going around it called again? So the answer is to do with FlowLayouts, and I was not setting up my top right I really was having a size of my supplementary header, but I was not attributes in this method: -: (NSString *) type atIndexPath:

  (UICollectionViewLayoutAttributes *) layoutAttributesForSupplementaryViewOfKind (NSIndexPath *) indexPath  

when who add a supplementary view of the array features which are only said:

  - (NSArray *) layoutAttributesForElementsInRect: (CGRect) rect  

Once I add an attribute to the complementary sequence of a type of Uaicollekshnelementkandsaisn header am, and layout method was being called, then end of my troubles

Another problem was that I was checking the index path for the viscous cells which I was trying to paste on the top of my collection view, and this sequential path check is in my order The supplemental view collided with the index path and was giving me trouble

To summarize: Make sure you are using UICollectionViewFlowLayout methods! And make sure that you do not have a taxing index path that remove your attributes from the attribute properties.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -