The UIViewController maintains a reference to the UICollectionView. The controller must change the inline flow layout using the UICollectionViewDelegateFlowLayout.
It is very easy to configure the presentation data source for yourself:
MyViewController.m
- (void)viewDidLoad { self.collectionView.dataSource = self; }
But how to set the controller as a representation of a stream of delegates to a view?
- (void)viewDidLoad { self.collectionView.dataSource= self; // self.collectionView.??? = self; }
I tried:
- (void)viewDidLoad { self.collectionView.dataSource= self; self.collectionView.collectionViewLayout = self; }
But I get an error: "Incompatible pointer types ...".
The collection header file is as follows:
Myviewcontroller.h
@interface MyViewController : UIViewController <UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
ios uicollectionview flowlayout
Rich Apodaca Oct 17 2018-12-12T00: 00Z
source share