Coder Social home page Coder Social logo

aplexpandablecollectionview's People

Contributors

michaelkamphausen avatar nischu avatar stel4e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aplexpandablecollectionview's Issues

Would be great if we could customize section separators and item separators

The expandable collection view uses first item in each section as the "header" and the rest as "items", and it'd be very useful if we could customize the separators for inter-section as well as inter-item (or is there an easy way to do that?)

PS: The response to the previous issue was super fast 👍

Slow when expanding

I have around 100 items in the collectionview with picture and text. When opening a section, if there are 10,20 items in the expanded section it's fine. When it contains 100 it takes around 1.5 seconds which is laggy for the user. Any solutions? (Maybe because each time i expand, the whole collectionview loads?) Thank you!

Add new sections dynamically

I was trying to implement adding of new sections when pressing a button. Instead of hard coded value for the number of sections I use an array of items and add new item into that array on button press; after that I call the [collectionView reloadData]; It seems simple enough but unfortunately the app crashes and I cannot manage to reload the data to show the new section. Can you please give me some advice on how could this be achieved in the current implementation. It would be very, very helpful.

Another suggestion: support UICollectionViewDelegateFlowLayout

Since APLSectionTopToBottomFlowLayout is a subclass of UICollectionViewFlowLayout, it naturally makes sense to support UICollectionViewDelegateFlowLayout so that individual item sizes & line spacings can be customized - for example, currently there is no way to make section height larger than item height.

APLExpandableCollectionView library not found while archiving

Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.

[!] The ARViewerDemo [Debug] target overrides the LIBRARY_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-ARViewerDemo/Pods-ARViewerDemo.debug.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` flag, or
- Remove the build settings from the target.

[!] The ARViewerDemo [Release] target overrides the LIBRARY_SEARCH_PATHS build setting defined in Pods/Target Support Files/Pods-ARViewerDemo/Pods-ARViewerDemo.release.xcconfig'. This can lead to problems with the CocoaPods installation - Use the $(inherited)` flag, or
- Remove the build settings from the target.

It seems that indexPath in cellForItemAtIndexPath not working properly - if cells are not visible

Hello,

I have extended the Demo to display a + or a - label in the section cells. I use cellForItemAtIndexPath to hide the label on item cells:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    APLCollectionViewCell* cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"APLCollectionViewCell" forIndexPath:indexPath];

    if (indexPath.item == 0) {
        cell.label.text = [NSString stringWithFormat:@"Section %li", (long)indexPath.section + 1];
        cell.backgroundColor = [UIColor colorWithRed:58./255. green:165./255. blue:192./255. alpha:1.];
        cell.indentView.hidden = YES;
        cell.label_OnOff.text = @"+";
    } else {
        cell.label.text = [NSString stringWithFormat:@"Item %li", (long)indexPath.row];
        cell.backgroundColor = [UIColor colorWithRed:58./255. green:165./255. blue:192./255. alpha:.5];
        cell.indentView.hidden = NO;
        [cell.label_OnOff setHidden:YES];
    }

    return cell;
}

To switch between + and - I implemented the delegate methods:

- (void)collectionView:(UICollectionView *)collectionView didCollapseItemAtIndexPath:(NSIndexPath *)indexPath
{
    APLCollectionViewCell *cell = (APLCollectionViewCell*)[collectionView cellForItemAtIndexPath:indexPath];
    cell.label_OnOff.text = @"+";
}
- (void)collectionView:(UICollectionView *)collectionView didExpandItemAtIndexPath:(NSIndexPath *)indexPath
{
    APLCollectionViewCell *cell = (APLCollectionViewCell*)[collectionView cellForItemAtIndexPath:indexPath];
    cell.label_OnOff.text = @"-";
}

As you can see in the screenshot - the label is hidden on some section cells and some item cells. I don't know why this happens - indexPath.item == 0 should check if a specific cell is a section or an item?
It seems that this issue is only present, if cells are not visible. After scrolling down and revealing new cells in the collection view - the label is not visible.
ios simulator screen shot 23 jun 2015 16 50 12

Collection View Datasource not getting Updated

I am using a single collectionview to load three collection of data based on three button clicks.First collection has say 2 items so the datasource gets updated, now if any of the remaining two collections has data more than 2 items, app crashes.

[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]

Cannot init from code

Hello! Thanks for sharing this! We should add a simple init method to support initing from code:

  • (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
    [self commonInit];
    }
    return self;
    }

sizeForItemAtIndexPath not works

in objective-c

  • (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
    {
    return CGSizeMake(320, 120);
    }

not works

in swift:

func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {

    return CGSize(width: self.view.frame.size.width, height: 120)
}

not works
:(

only i can change size item with this code:

let layout:APLExpandableSectionFlowLayout = self.collectionView.collectionViewLayout as! APLExpandableSectionFlowLayout
layout.itemSize = CGSizeMake(self.view.frame.size.width, 120);
layout.minimumLineSpacing = 4
layout.scrollDirection = .Vertical
layout.sectionInset = UIEdgeInsetsMake(8, 8, 0, 8);

but i need to do by NSIndexPath

DataSource responsibilities

I have been browsing through the code base, and have a question: I don't really understand why you need the following methods to manipulate the data source:

- (void)addExpandedSection:(BOOL)isExpanded;
- (void)insertExpandedSection:(BOOL)isExpanded atIndex:(NSUInteger)index;

In the end, I could just change my original dataSource and then call reloadData to have the same effect, or am I missing something (ignoring that it seems to be the only way to expand #16 atm)? Generally, I don't understand why the collection takes over data source responsibilities. In my eyes it just encourages inconsistencies between the "two" different data sources.

And I wanted to thank you for your work! I wanted to build exactly the same view, but then discovered your solution.

collectionViewLayout:sizeForItemAtIndexPath: doesn't work!

Hi,

I'm trying to change size of individual collection view cell's using "collectionViewLayout:sizeForItemAtIndexPath:" method but it always override it with layout.itemSize value.

itemSize: 375,40
sizeForIndexPath method return size of item which is (50,50). When i check the cell size it's (375,40) again.

Help please..

Collapse CollectionView

How can we collapse previous selection when a new item a selected.
I want only one item to be in expanded mode at a time

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.