eoghain / rbcollectionviewinfofolderlayout Goto Github PK
View Code? Open in Web Editor NEWA UICollectionViewLayout that displays a folder of extra information below your items.
License: MIT License
A UICollectionViewLayout that displays a folder of extra information below your items.
License: MIT License
Hi there - nice tool by the way...
I'm struggling with an implementation and hoping you can help...
I have about 9-10 sections each with their own .json file and selected from a different view. I have all the data loading fine and all looks good. Until I choose another section from a separate view having left one of the folders open. The folder itself collapses away, but the folder view remains and if just try to load the data into the open view it doesn't always format properly.
I only have one section per view with multiple cells / folders in that view. e.g. The menu calls the collection view to display data based on a NSNotification it receives - which all works fine with the exception of an open folder not closing if left open when a new notification id received. And as much as I have tried I can't seem to call that folder to close either in the notification or in the collection view.
Is there a way to use the closeAllOpenFolders or anything else when viewing a new data view or when leaving an existing view to force any open folders to close? Exactly like it does when selecting different cells within the same section in the demo.
Thanks!!
The following function is in the file RBCollectionViewInfoFolderLayout.m:
- (void)toggleFolderViewForIndexPath:(NSIndexPath *)indexPath
{
NSIndexPath * visibleFolder = self.visibleFolderInSection[@( indexPath.section )];
NSInteger selectedFolderRow = [self rowForIndexPath:indexPath];
NSInteger openFolderRow = (visibleFolder) ? [self rowForIndexPath:visibleFolder] : selectedFolderRow;
if ([visibleFolder isEqual:indexPath])
{
[self.visibleFolderInSection removeObjectForKey:@( indexPath.section )];
}
else
{
self.visibleFolderInSection[@( indexPath.section )] = indexPath;
UICollectionViewLayoutAttributes * attributes = self.layoutInformation[RBCollectionViewInfoFolderFolderKind][indexPath];
CGRect scrollFrame = attributes.frame;
scrollFrame.origin.y += attributes.frame.size.height;
scrollFrame.size.height = 5;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.collectionView scrollRectToVisible:scrollFrame animated:YES];
});
}
// If we are opening a row below an already open row reload the visible item
if (selectedFolderRow > openFolderRow)
{
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:visibleFolder.section]];
}
else // reload the selected item
{
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:indexPath.section]];
}
}
Can somebody please explain it to me line by line because for me this reloadSections part is reloading all my data over the previous data i.e. overlapping the data once from index 0 to n and vice versa every time I open a folder layout.
I have been doing customizations to the project but now the folder view just pops in and out. I want to get it back to animating.
What should I do to fix it?
I really like the slide down data view in my own project.
I need help in identifying as to which code is actually doing it?
Sometimes the Dimple is getting hidden
Hello. Please try and find it to excuse me for opening an issue for something I'd make rather as a question. I could not find any other means of contacting the developer.
I'd like to see how I might use this to implement a UITableView into a selected folder.
Similar to how iTunes 11 does in their stock application and quite possibly resizing the folder based on the UITableView's size?
Again, I really appreciate your project! You sure know a lot about! I just wanted to pick your brain for adding a UITableView to a folder view before I botch up a crappy implementation of the idea I am going for.
Thanks.
I find that when I use this code with a bunch of items (like hundreds), scrolling is incredibly slow. Is this a problem with the custom layout?
I'm trying to run the demo application, when I do this I get the following error
RBCollectionViewInfoFolderLayout[19992:1154545] [/BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreUI_Sim/CoreUI-371.4/Bom/Storage/BOMStorage.c:507] stream invalid; root page is outside of address range
2016-02-12 19:16:47.198 RBCollectionViewInfoFolderLayout[19992:1154484] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCache setObject:forKey:cost:]: attempt to insert nil value (key: http://i.annihil.us/u/prod/marvel/i/mg/2/d0/4bc6815155c10/portrait_incredible.jpg)'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109a20e65 exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000109499deb objc_exception_throw + 48
2 CoreFoundation 0x000000010993c581 -[NSCache setObject:forKey:cost:] + 401
3 RBCollectionViewInfoFolderLayout 0x000000010781276a __56-[ViewController collectionView:cellForItemAtIndexPath:]_block_invoke_2 + 106
4 libdispatch.dylib 0x000000010a47249b _dispatch_client_callout + 8
5 libdispatch.dylib 0x000000010a45bc3c _dispatch_barrier_sync_f_slow_invoke + 284
6 libdispatch.dylib 0x000000010a47249b _dispatch_client_callout + 8
7 libdispatch.dylib 0x000000010a45a2af _dispatch_main_queue_callback_4CF + 1738
8 CoreFoundation 0x0000000109980d09 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
9 CoreFoundation 0x00000001099422c9 __CFRunLoopRun + 2073
10 CoreFoundation 0x0000000109941828 CFRunLoopRunSpecific + 488
11 GraphicsServices 0x000000010c79ead2 GSEventRunModal + 161
12 UIKit 0x0000000107b06610 UIApplicationMain + 171
13 RBCollectionViewInfoFolderLayout 0x000000010781c00f main + 111
14 libdyld.dylib 0x000000010a4a692d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
I'm also wondering how can I implement this when I already have made a custom cell myself with a .xib file? I'm not that experienced with swift/objective c(I'm using swift) so I'm having trouble implementing it.
Sometime randamly the dimple is getting hide automatically.please suggestions me the reason.
when I first ran this demo, I get this error.
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan 222.5]'
How to fixe this? Thx!
I currently dont want the header and footer for the sections. How can I disable it or remove it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.