ios - How to add UIView as header view for UICollectionViewController -


i have uicollectionviewcontroller trying add uiview header view collectionview. current attempt not displaying uiview after amount of time of following multitude of guides. hoping can point me in right direction.

my current approach:

set height of supplemental view , register

viewdidload(){    collectionview.registerclassforsupplementaryview(typeof(collectionheader), uicollectionelementkindsection.header, "headerview");    uicollectionviewflowlayout layout = new uicollectionviewflowlayout();    layout.headerreferencesize = setheader(this).frame.size; //setheader returns uiview    collectionview.setcollectionviewlayout(layout, true); } 

gets supplemental view

public override uicollectionreusableview getviewforsupplementaryelement(uicollectionview collectionview, nsstring elementkind, nsindexpath indexpath) {     collectionheader headerview = (collectionheader)collectionview.dequeuereusablesupplementaryview(uicollectionelementkindsection.header, "headerview", indexpath);     headerview.owner = this;     headerview.view = setheader(this);//setheader returns uiview     return headerview; } 

create view via class (not sure how/why this)

public class collectionheader : uicollectionreusableview {     public uiview view {          { return view; }         set { view = value; setneedsdisplay();}     }     public photographcontroller owner;     [export("initwithframe:")]     public collectionheader(system.drawing.rectanglef frame) :base(frame) {         view = new uiview(setheader(owner).frame);         addsubview(view);     } } 

thanks help!


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -