Uicollectionviewdatasource protocol
This protocol is mainly used for the processing of CollectionView related data, including the following methods:
Set the number of partitions (this is an optional implementation)
-(Nsinteger) Numberofsectionsincollectionview: (Uicollectionview *) CollectionView;
Set the number of item per partition (must be implemented)
-(Nsinteger) CollectionView: (Uicollectionview *) CollectionView numberofitemsinsection: (NSInteger) Section;
Sets the property that returns each item (must be implemented)
-(Uicollectionviewcell *) CollectionView: (Uicollectionview *) CollectionView Cellforitematindexpath: (NSIndexPath *) Indexpath;
Set the head View and tail view (if needed)
-(Uicollectionreusableview *) CollectionView: (Uicollectionview *) CollectionView Viewforsupplementaryelementofkind :(NSString *) kind Atindexpath: (Nsindexpath *) Indexpath;
Sets whether an item can be moved returns no indicates that it cannot be moved
-(BOOL) CollectionView: (Uicollectionview *) CollectionView Canmoveitematindexpath: (Nsindexpath *) IndexPath NS_ Available_ios (9_0);
This method is called when the item is moved
-(void) CollectionView: (Uicollectionview *) CollectionView Moveitematindexpath: (Nsindexpath *) Sourceindexpath Toindexpath: (nsindexpath*) Destinationindexpath;
Uicollectionviewdelegate protocol
This protocol is used to set up and handle CollectionView functions and some logic, all of which are optional implementations
Whether to allow highlighting of an item, returning no will not enter the highlighted state.
-(BOOL) CollectionView: (Uicollectionview *) CollectionView Shouldhighlightitematindexpath: (Nsindexpath *) IndexPath;
method to trigger when item is highlighted
-(void) CollectionView: (Uicollectionview *) CollectionView Didhighlightitematindexpath: (Nsindexpath *) Indexpath;
method to trigger when highlighting is finished
-(void) CollectionView: (Uicollectionview *) CollectionView Didunhighlightitematindexpath: (Nsindexpath *) Indexpath;
Whether an item can be selected returns no cannot be selected
-(BOOL) CollectionView: (Uicollectionview *) CollectionView Shouldselectitematindexpath: (Nsindexpath *) IndexPath;
Whether you can uncheck an item
-(BOOL) CollectionView: (Uicollectionview *) CollectionView Shoulddeselectitematindexpath: (Nsindexpath *) IndexPath;
Select the method that an item triggers
-(void) CollectionView: (Uicollectionview *) CollectionView Didselectitematindexpath: (Nsindexpath *) Indexpath;
The method that is triggered when an item is deselected
-(void) CollectionView: (Uicollectionview *) CollectionView Diddeselectitematindexpath: (Nsindexpath *) Indexpath;
method to invoke when the Kinsoku view will be loaded
-(void) CollectionView: (Uicollectionview *) CollectionView Willdisplaysupplementaryview: ( Uicollectionreusableview *) View Forelementkind: (NSString *) elementkind Atindexpath: (Nsindexpath *) IndexPath NS_ Available_ios (8_0);
The method that was triggered when an item was already displayed
-(void) CollectionView: (Uicollectionview *) CollectionView Didenddisplayingcell: (Uicollectionviewcell *) Cell Foritematindexpath: (Nsindexpath *) Indexpath;
The method that is triggered when a kinsoku view has been shown
-(void) CollectionView: (Uicollectionview *) CollectionView Didenddisplayingsupplementaryview: ( Uicollectionreusableview *) View Forelementofkind: (NSString *) elementkind Atindexpath: (Nsindexpath *) IndexPath;
method to invoke when an item is about to be loaded
-(void) CollectionView: (Uicollectionview *) CollectionView Willdisplaycell: (Uicollectionviewcell *) cell Foritematindexpath: (Nsindexpath *) Indexpath Ns_available_ios (8_0);
This method sets whether to show the long press Menu
-(BOOL) CollectionView: (Uicollectionview *) CollectionView Shouldshowmenuforitematindexpath: (NSIndexPath *) Indexpath;
This method is used to set the menu options to be displayed
ID) Sender
This method is used to implement the Trigger method after clicking the menu button, passing the test, only Copy,cut and paste three methods can be used
-(voidID) sender;
CollectionView method to be called when re-layout is performed
-(nonnull uicollectionviewtransitionlayout *) CollectionView: (Uicollectionview *) CollectionView Transitionlayoutforoldlayout: (uicollectionviewlayout *) fromlayout newlayout: (uicollectionviewlayout *) toLayout;
IOS Flow Layout Uicollectionview Use (Uicollectionview proxy method)