arnauddorgans / InfiniteLayout

Horizontal and Vertical infinite scrolling feature for UICollectionView with Paging, NSProxy delegate, Reactive extension, SectionModel & AnimatableSectionModel support
MIT License
517 stars 63 forks source link

Obj-c call method #3

Closed antons81 closed 6 years ago

antons81 commented 6 years ago

Hi, I am gettin wrong indexPath, while inserting item to array and reloading collection view. How to call this method from obj-c?

func section(from infiniteSection: Int) -> Int

arnauddorgans commented 6 years ago

Hi, You have to call section(from:) from collectionView.infiniteLatout, not directly from collectionView

antons81 commented 6 years ago

Hi, thanks for the quick answer. But these methods are different.

 public func section(from infiniteSection: Int) -> Int {
        return InfiniteDataSources.section(from: infiniteSection, numberOfSections: delegateNumberOfSections)
    }
  public func indexPath(from infiniteIndexPath: IndexPath) -> IndexPath {
        return InfiniteDataSources.indexPath(from: infiniteIndexPath,
                                             numberOfSections: delegateNumberOfSections,
                                             numberOfItems: delegateNumberOfItems(in: infiniteIndexPath.section))
    }`
antons81 commented 6 years ago

Ok solved it. I added layout files manually to the project and added to extension and class @objc/@objcMembers. Then called NSIndexPath *index = [self.selectedItemsCollection indexPathFrom:indexPath];

It solved my issue