c# - Xamarin IOS Collection View With Custom Cell -


i working on xamarin ios, want display items in grid style using collection views concept. tried sample collection view example. sample collection view example

but items displaying given example. want display items in grid style, please saw below image.

enter image description here

this crude example quick test doing on same example code:

enter image description here

    [export ("initwithframe:")]     public productcell (cgrect frame) : base (frame)     {         backgroundview = new uiview{ backgroundcolor = uicolor.darkgray };         selectedbackgroundview = new uiview{ backgroundcolor = uicolor.green };          contentview.layer.bordercolor = uicolor.lightgray.cgcolor;         contentview.layer.borderwidth = 2.0f;         contentview.backgroundcolor = uicolor.gray;          cellviewcontainer = new uiview ();         cellviewcontainer.autoresizingmask = uiviewautoresizing.flexiblewidth | uiviewautoresizing.flexibleheight;          imageview = new uiimageview (uiimage.frombundle ("placeholder.png"));         productname = new uilabel {             text = "name",             textcolor = uicolor.black,             backgroundcolor = uicolor.white,             textalignment = uitextalignment.center         };         price = new uilabel {             text = "price",             textcolor = uicolor.black,             backgroundcolor = uicolor.red,             textalignment = uitextalignment.center         };         var labelheight = (contentview.bounds.height - 2) / 2;         var labelwidth = (contentview.bounds.width - 2 ) / 2;         productname.frame = new cgrect(5, 5, labelwidth, labelheight);         price.frame = new cgrect(5, labelheight, labelwidth, labelheight);         imageview.frame = new cgrect (labelwidth, 0, labelwidth, contentview.bounds.height - 2);           contentview.addsubviews (new uiview[] { imageview, productname, price });     } 

Comments

Popular posts from this blog

javascript - Hide toolbar of pdf file opened inside iframe using firefox -

Ansible - ERROR! the field 'hosts' is required but was not set -

Copy range with conditional formatting -