xamarin.ios - "GetSizeForItem" for a UICollectionView in Xamarin with UICollectionViewFlowLayout does not get called -
i have uiviewcontroller
has uicollectionview
added subview in viewdidload. using uicollectionviewflowlayout
, have created custom mvxcollectionviewsource
manage cells.
i provide cell information in constructor of layout object not make flexible device , orientation changes.
uicollectionviewlayout layout = new uicollectionviewflowlayout () {itemsize = new sizef (354, 150), scrolldirection = uicollectionviewscrolldirection.vertical };
allocating uicollectionview in viewdidload method.
collectionview = new uicollectionview (this.view.bounds, layout); collectionview.delegate = new customviewdelegate(); collectionview.registerclassforcell (typeof(projectcollectioncell), projectcollectioncell.key); collectionview.source = new projectcollectionsource (collectionview, this,projectcollectioncell.key); collectionview.backgroundcolor = uicolor.clear; // collectionview.registerclassforsupplementaryview (typeof(header), uicollectionelementkindsection.header, headerid); collectionview.allowsmultipleselection = true; this.view.addsubview (collectionview);
now projectcollectionsource custom source , have created uicollectionviewdelegateflowlayout
mentioned here.
the uicollectionviewdelegateflowlayout
below never gets called.
class customviewdelegate: uicollectionviewdelegateflowlayout { public override coregraphics.cgsize getsizeforitem (uicollectionview collectionview, uicollectionviewlayout layout, nsindexpath indexpath) { return new coregraphics.cgsize (100, 100); } }
Comments
Post a Comment