Giter Club home page Giter Club logo

customcollectionviewlayout's People

Contributors

chrisleversuch avatar joamafer 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

customcollectionviewlayout's Issues

reloadData does NOT work

Is there a way I can use collectionView reloadData on this collection view? Every time I try to reload the data I get an error like this : 'UICollectionView received layout attributes for a cell with an index path that does not exist:

I am trying to include a search feature to filter collection results but it keeps breaking.

Any ideas on this?

Crash on collectionView.deleteSections(...)

If I add a button that is removing some section, it is crashing after scrolling to last section:

@IBAction func didClick(sender: AnyObject) {
        numberOfSections -= 1;
        let set = NSIndexSet(index: 2)
        self.collectionView.deleteSections(set)
    }

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UICollectionView received layout attributes for a cell with an index path that does not exist: <NSIndexPath: 0xc000000000003116> {length = 2, path = 49 - 0}'

Can you help me how to resolve this issue?

Collection View is not working at all

I am trying to set this up programmatically in objective-c. I have added the CustomCollectionViewLayout files from this repository and tried to initialize a collection view inside a UIViewController with the layout but this is what I get:

screen shot 2017-10-30 at 11 40 39 am

Collectionview Cell spacing

how can i add cell spacing to my cells . i need a space of 10 after 1st column and 5 after each column. please help.

screen shot 2016-12-02 at 2 56 28 am

swift 2

any updates for swift 2 ?

PrepareLayout section variable unidentified

In the Objective-C version of CustomCollectionViewLayout.m, inside the prepareLayout method, following code is written:

// Tip: If we don't know the number of columns we can call the following method and use the NSUInteger object instead of the NUMBEROFCOLUMNS macro
    // NSUInteger numberOfItems = [self.collectionView numberOfItemsInSection:section];

prepareLayout, will be called everytime the bounds change. In that case what would be the value of "section" variable for "numberOfItemsInSection:section". I can't see to find it. If I uncomment it, in my code, it gives error, if I use your file, everything is fine.

I just copied the demo's .m file into my project's .m file

How to increase the section height according to the text.

Hi,
I used CustomCollectionViewLayout in my app. i have to maintain the constant width for few columns. by using the width when the text is increased the section height need to be increase . Please give the suggestions to implement dynamic section height to display all the rows in that section contain same height.(Like excel page).

Thank you

Scrolling Collection View causes the cell content to disappear

When i have more than 7 sections or rows in the collection view, if I scroll the collectionview up and down, i see that the cell content in the second,third and fourth section are getting misplaced or going blank. The header row that is fixed does not have any issues.

How do we resolve this.

unknown number of columns

 // Tip: If we don't know the number of columns we can call the following method and use the NSUInteger object instead of the NUMBEROFCOLUMNS macro
     NSUInteger numberOfItems = [self.collectionView numberOfItemsInSection:section];

where does this section variable come from?

Stop Diagonal Scroll

It is a great library i integrated it and work properly but there is an issue that i want them to scroll the row either horizontal or vertical at one time (when user move its finger diagonally it scroll both the rows),can you please tell me how to stop this behaviour on diagonal scroll as i am very thankful to you.

Dynamic row

how to add dynamic rows and columns in CustomCollectionViewLayout class

Stick last section to the bottom

So I used this piece of code, to make the last section stick to the bottom:

if (section == [self.collectionView numberOfSections]-1)
                {
                    CGRect frame = attributes.frame;
                    frame.origin.y = self.collectionView.contentOffset.y + self.collectionView.frame.size.height - 30;
                    attributes.frame = frame;
                }

But, if the last section is pinned to bottom, the collectionview is not able to scroll. If I change frame.origin.y = self.collectionView.contentOffset.y + self.collectionView.frame.size.height - 30;, to frame.origin.y = self.collectionView.contentOffset.y + self.collectionView.frame.size.height + 70;It scrolls little bit downwards until the last section is visible and stops there.

Crashing

Hi,

I am trying to using this library in Xcode 9.3.
When I increase or decrease the column it gets crashed. Please let me know what need to do?

Thanks,
Rahul Gupta

Loop the content

Hello, i'm new in swift programming

I see in your example this
contentCell.contentLabel.text = "Content"
that was code for set the cell content right?

So, what if i have data that need looping?
Did i just go "for" then inside the looping insert this
contentCell.contentLabel.text = thearray
?

Swift3

Can you please update this code for swift3

How can i perfom item selection on collection view?

Hello,

I'm trying to open a new viewcontroller on item selection.

If I add an IBAction on my UICollectionViewCell class, I cannot open a new viewcontroller.
I try to add a delegate method on my actual viewcontroller, like
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath),
but when i "click" on an item, it doesn't perfom method.

I'm checked every parameter and setting, all seems to be ok. I don't know what I have to try more.

Thank you for your time.

Adding Header to CustomCollectionView

Hello, and thanks for this great code!

I'm trying to add a header to the view, using the following:

  • in the controller, register the Header view supplementary view
collectionView .registerNib(UINib(nibName: "HeaderMulticolumn", bundle: nil), forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "Header")

then later, implement the delegate methods:

func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {

let headerView = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "Header", forIndexPath: indexPath) 

            headerView.backgroundColor = UIColor.blueColor();
            return headerView
}

and in the layout class


    override func layoutAttributesForSupplementaryViewOfKind(elementKind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? {
        let attributes = UICollectionViewLayoutAttributes(forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withIndexPath: indexPath)

        let headerHeight = CGFloat(50)
        attributes.frame = CGRectMake(0, 0, self.collectionView!.frame.size.width, headerHeight)

        return attributes;
    }

It's not necessarily a question about your code, but I can't get collectionView: viewForSupplementaryElementOfKind: to be called at all. Is there any chance you could point at the right direction to have Headers added to your custom UICollectionView class?
note: I tried with different layout classes, without changing the controller class, and managed to have headers added, so it must come from the way CustomCollectionViewLayout operates (but I can't see why)
thanks!

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.