Class UICollectionView

All Implemented Interfaces:
CALayerDelegate, NSCoding, NSObjectProtocol, UIAccessibilityIdentification, UIActivityItemsConfigurationProviding, UIAppearanceContainer, UICoordinateSpace, UIDataSourceTranslating, UIDynamicItem, UIFocusEnvironment, UIFocusItem, UIFocusItemContainer, UIFocusItemScrollableContainer, UILargeContentViewerItem, UIPasteConfigurationSupporting, UIResponderStandardEditActions, UISpringLoadedInteractionSupporting, UITraitEnvironment, UIUserActivityRestoring, ObjCProtocol

public class UICollectionView
extends UIScrollView
implements UIDataSourceTranslating, UISpringLoadedInteractionSupporting
  • Constructor Details

    • UICollectionView

      public UICollectionView()
    • UICollectionView

      protected UICollectionView​(NSObject.Handle h, long handle)
    • UICollectionView

      protected UICollectionView​(NSObject.SkipInit skipInit)
    • UICollectionView

      public UICollectionView​(CGRect frame, UICollectionViewLayout layout)
    • UICollectionView

      public UICollectionView​(NSCoder coder)
    • UICollectionView

      public UICollectionView​(CGRect frame)
  • Method Details

    • getCollectionViewLayout

      public UICollectionViewLayout getCollectionViewLayout()
    • setCollectionViewLayout

      public void setCollectionViewLayout​(UICollectionViewLayout v)
    • getDelegate

      public UICollectionViewDelegate getDelegate()
      Overrides:
      getDelegate in class UIScrollView
    • setDelegate

      public void setDelegate​(UICollectionViewDelegate v)
    • getDataSource

      public UICollectionViewDataSource getDataSource()
    • setDataSource

      public void setDataSource​(UICollectionViewDataSource v)
    • getPrefetchDataSource

      public UICollectionViewDataSourcePrefetching getPrefetchDataSource()
      Since:
      Available in iOS 10.0 and later.
    • setPrefetchDataSource

      public void setPrefetchDataSource​(UICollectionViewDataSourcePrefetching v)
      Since:
      Available in iOS 10.0 and later.
    • isPrefetchingEnabled

      public boolean isPrefetchingEnabled()
      Since:
      Available in iOS 10.0 and later.
    • setPrefetchingEnabled

      public void setPrefetchingEnabled​(boolean v)
      Since:
      Available in iOS 10.0 and later.
    • getDragDelegate

      public UICollectionViewDragDelegate getDragDelegate()
      Since:
      Available in iOS 11.0 and later.
    • setDragDelegate

      public void setDragDelegate​(UICollectionViewDragDelegate v)
      Since:
      Available in iOS 11.0 and later.
    • getDropDelegate

      public UICollectionViewDropDelegate getDropDelegate()
      Since:
      Available in iOS 11.0 and later.
    • setDropDelegate

      public void setDropDelegate​(UICollectionViewDropDelegate v)
      Since:
      Available in iOS 11.0 and later.
    • isDragInteractionEnabled

      public boolean isDragInteractionEnabled()
      Since:
      Available in iOS 11.0 and later.
    • setDragInteractionEnabled

      public void setDragInteractionEnabled​(boolean v)
      Since:
      Available in iOS 11.0 and later.
    • getContextMenuInteraction

      public UIContextMenuInteraction getContextMenuInteraction()
      Since:
      Available in iOS 13.2 and later.
    • getReorderingCadence

      public UICollectionViewReorderingCadence getReorderingCadence()
      Since:
      Available in iOS 11.0 and later.
    • setReorderingCadence

      public void setReorderingCadence​(UICollectionViewReorderingCadence v)
      Since:
      Available in iOS 11.0 and later.
    • getBackgroundView

      public UIView getBackgroundView()
    • setBackgroundView

      public void setBackgroundView​(UIView v)
    • allowsSelection

      public boolean allowsSelection()
    • setAllowsSelection

      public void setAllowsSelection​(boolean v)
    • allowsMultipleSelection

      public boolean allowsMultipleSelection()
    • setAllowsMultipleSelection

      public void setAllowsMultipleSelection​(boolean v)
    • getIndexPathsForSelectedItems

      public NSArray<NSIndexPath> getIndexPathsForSelectedItems()
    • hasUncommittedUpdates

      public boolean hasUncommittedUpdates()
      Since:
      Available in iOS 11.0 and later.
    • getNumberOfSections

      public long getNumberOfSections()
    • getVisibleCells

      public NSArray<UICollectionViewCell> getVisibleCells()
    • getIndexPathsForVisibleItems

      public NSArray<NSIndexPath> getIndexPathsForVisibleItems()
    • remembersLastFocusedIndexPath

      public boolean remembersLastFocusedIndexPath()
      Since:
      Available in iOS 9.0 and later.
    • setRemembersLastFocusedIndexPath

      public void setRemembersLastFocusedIndexPath​(boolean v)
      Since:
      Available in iOS 9.0 and later.
    • isSelectionFollowsFocus

      public boolean isSelectionFollowsFocus()
      Since:
      Available in iOS 14.0 and later.
    • setSelectionFollowsFocus

      public void setSelectionFollowsFocus​(boolean v)
      Since:
      Available in iOS 14.0 and later.
    • allowsFocus

      public boolean allowsFocus()
      Since:
      Available in iOS 15.0 and later.
    • setAllowsFocus

      public void setAllowsFocus​(boolean v)
      Since:
      Available in iOS 15.0 and later.
    • allowsFocusDuringEditing

      public boolean allowsFocusDuringEditing()
      Since:
      Available in iOS 15.0 and later.
    • setAllowsFocusDuringEditing

      public void setAllowsFocusDuringEditing​(boolean v)
      Since:
      Available in iOS 15.0 and later.
    • hasActiveDrag

      public boolean hasActiveDrag()
      Since:
      Available in iOS 11.0 and later.
    • hasActiveDrop

      public boolean hasActiveDrop()
      Since:
      Available in iOS 11.0 and later.
    • isEditing

      public boolean isEditing()
      Since:
      Available in iOS 14.0 and later.
    • setEditing

      public void setEditing​(boolean v)
      Since:
      Available in iOS 14.0 and later.
    • allowsSelectionDuringEditing

      public boolean allowsSelectionDuringEditing()
      Since:
      Available in iOS 14.0 and later.
    • setAllowsSelectionDuringEditing

      public void setAllowsSelectionDuringEditing​(boolean v)
      Since:
      Available in iOS 14.0 and later.
    • allowsMultipleSelectionDuringEditing

      public boolean allowsMultipleSelectionDuringEditing()
      Since:
      Available in iOS 14.0 and later.
    • setAllowsMultipleSelectionDuringEditing

      public void setAllowsMultipleSelectionDuringEditing​(boolean v)
      Since:
      Available in iOS 14.0 and later.
    • getLayerClass

      public static Class<? extends CALayer> getLayerClass()
    • isSpringLoaded

      public boolean isSpringLoaded()
      Specified by:
      isSpringLoaded in interface UISpringLoadedInteractionSupporting
      Since:
      Available in iOS 11.0 and later.
    • setSpringLoaded

      public void setSpringLoaded​(boolean v)
      Specified by:
      setSpringLoaded in interface UISpringLoadedInteractionSupporting
      Since:
      Available in iOS 11.0 and later.
    • setModel

      public void setModel​(UICollectionViewModel model)
    • getModel

      public UICollectionViewModel getModel()
    • init

      protected long init​(CGRect frame, UICollectionViewLayout layout)
    • init

      protected long init​(NSCoder coder)
      Overrides:
      init in class UIView
    • registerReusableCellClass

      public void registerReusableCellClass​(Class<? extends UICollectionViewCell> cellClass, String identifier)
    • registerReusableCellNib

      public void registerReusableCellNib​(UINib nib, String identifier)
    • registerReusableSupplementaryViewClass

      public void registerReusableSupplementaryViewClass​(Class<? extends UICollectionReusableView> viewClass, UICollectionElementKind elementKind, String identifier)
    • registerReusableSupplementaryViewNib

      public void registerReusableSupplementaryViewNib​(UINib nib, UICollectionElementKind kind, String identifier)
    • dequeueReusableCell

      public UICollectionReusableView dequeueReusableCell​(String identifier, NSIndexPath indexPath)
    • dequeueReusableSupplementaryView

      public UICollectionReusableView dequeueReusableSupplementaryView​(UICollectionElementKind elementKind, String identifier, NSIndexPath indexPath)
    • dequeueConfiguredReusableCell

      public UICollectionViewCell dequeueConfiguredReusableCell​(UICollectionViewCellRegistration registration, NSIndexPath indexPath, NSObject item)
      Since:
      Available in iOS 14.0 and later.
    • dequeueConfiguredReusableSupplementaryView

      public UICollectionReusableView dequeueConfiguredReusableSupplementaryView​(UICollectionViewSupplementaryRegistration registration, NSIndexPath indexPath)
      Since:
      Available in iOS 14.0 and later.
    • selectItem

      public void selectItem​(NSIndexPath indexPath, boolean animated, UICollectionViewScrollPosition scrollPosition)
    • deselectItem

      public void deselectItem​(NSIndexPath indexPath, boolean animated)
    • reloadData

      public void reloadData()
    • setCollectionViewLayout

      public void setCollectionViewLayout​(UICollectionViewLayout layout, boolean animated)
    • setCollectionViewLayout

      public void setCollectionViewLayout​(UICollectionViewLayout layout, boolean animated, VoidBooleanBlock completion)
    • startInteractiveTransition

      public UICollectionViewTransitionLayout startInteractiveTransition​(UICollectionViewLayout layout, VoidBlock2<Boolean,​Boolean> completion)
    • finishInteractiveTransition

      public void finishInteractiveTransition()
    • cancelInteractiveTransition

      public void cancelInteractiveTransition()
    • getNumberOfItemsInSection

      public long getNumberOfItemsInSection​(long section)
    • getLayoutAttributesForItem

      public UICollectionViewLayoutAttributes getLayoutAttributesForItem​(NSIndexPath indexPath)
    • getLayoutAttributesForSupplementaryElement

      public UICollectionViewLayoutAttributes getLayoutAttributesForSupplementaryElement​(UICollectionElementKind kind, NSIndexPath indexPath)
    • getIndexPathForItem

      public NSIndexPath getIndexPathForItem​(CGPoint point)
    • getIndexPathForCell

      public NSIndexPath getIndexPathForCell​(UICollectionViewCell cell)
    • getCellForItem

      public UICollectionViewCell getCellForItem​(NSIndexPath indexPath)
    • getSupplementaryView

      public UICollectionReusableView getSupplementaryView​(String elementKind, NSIndexPath indexPath)
      Since:
      Available in iOS 9.0 and later.
    • getVisibleSupplementaryViews

      public NSArray<UICollectionReusableView> getVisibleSupplementaryViews​(String elementKind)
      Since:
      Available in iOS 9.0 and later.
    • getIndexPathsForVisibleSupplementaryElements

      public NSArray<NSIndexPath> getIndexPathsForVisibleSupplementaryElements​(String elementKind)
      Since:
      Available in iOS 9.0 and later.
    • scrollToItem

      public void scrollToItem​(NSIndexPath indexPath, UICollectionViewScrollPosition scrollPosition, boolean animated)
    • insertSections

      public void insertSections​(NSIndexSet sections)
    • deleteSections

      public void deleteSections​(NSIndexSet sections)
    • moveSection

      public void moveSection​(long section, long newSection)
    • reloadSections

      public void reloadSections​(NSIndexSet sections)
    • insertItems

      public void insertItems​(NSArray<NSIndexPath> indexPaths)
    • deleteItems

      public void deleteItems​(NSArray<NSIndexPath> indexPaths)
    • moveItem

      public void moveItem​(NSIndexPath indexPath, NSIndexPath newIndexPath)
    • reloadItems

      public void reloadItems​(NSArray<NSIndexPath> indexPaths)
    • reconfigureItemsAtIndexPaths

      public void reconfigureItemsAtIndexPaths​(NSArray<NSIndexPath> indexPaths)
      Since:
      Available in iOS 15.0 and later.
    • performBatchUpdates

      public void performBatchUpdates​(Runnable updates, VoidBooleanBlock completion)
    • beginInteractiveMovement

      public boolean beginInteractiveMovement​(NSIndexPath indexPath)
      Since:
      Available in iOS 9.0 and later.
    • updateInteractiveMovement

      public void updateInteractiveMovement​(CGPoint targetPosition)
      Since:
      Available in iOS 9.0 and later.
    • endInteractiveMovement

      public void endInteractiveMovement()
      Since:
      Available in iOS 9.0 and later.
    • cancelInteractiveMovement

      public void cancelInteractiveMovement()
      Since:
      Available in iOS 9.0 and later.
    • getUserInterfaceLayoutDirection

      public static UIUserInterfaceLayoutDirection getUserInterfaceLayoutDirection​(UISemanticContentAttribute attribute)
      Since:
      Available in iOS 9.0 and later.
    • getUserInterfaceLayoutDirection

      public static UIUserInterfaceLayoutDirection getUserInterfaceLayoutDirection​(UISemanticContentAttribute semanticContentAttribute, UIUserInterfaceLayoutDirection layoutDirection)
      Since:
      Available in iOS 10.0 and later.
    • presentationSectionIndexForDataSourceSectionIndex

      public long presentationSectionIndexForDataSourceSectionIndex​(long dataSourceSectionIndex)
      Specified by:
      presentationSectionIndexForDataSourceSectionIndex in interface UIDataSourceTranslating
    • dataSourceSectionIndexForPresentationSectionIndex

      public long dataSourceSectionIndexForPresentationSectionIndex​(long presentationSectionIndex)
      Specified by:
      dataSourceSectionIndexForPresentationSectionIndex in interface UIDataSourceTranslating
    • presentationIndexPathForDataSourceIndexPath

      public NSIndexPath presentationIndexPathForDataSourceIndexPath​(NSIndexPath dataSourceIndexPath)
      Specified by:
      presentationIndexPathForDataSourceIndexPath in interface UIDataSourceTranslating
    • dataSourceIndexPathForPresentationIndexPath

      public NSIndexPath dataSourceIndexPathForPresentationIndexPath​(NSIndexPath presentationIndexPath)
      Specified by:
      dataSourceIndexPathForPresentationIndexPath in interface UIDataSourceTranslating
    • performUsingPresentationValues

      public void performUsingPresentationValues​(Runnable actionsToTranslate)
      Specified by:
      performUsingPresentationValues in interface UIDataSourceTranslating