Pinterest style layout iOS storyboards -


i want create design :-

enter image description here

i using storyboards , cannot make thing work. have simple collection view of , works fine except cells show twice. there way can achieve not using library , having random heights cells?

this storyboard :-

enter image description here


mycollectioncontroller

public mycollectioncontroller(intptr handle) : base(handle) {  }  public override void viewdidload () {     base.viewdidload ();     data = makedataforrecyclerview(pageindex); }  public override nint numberofsections (uicollectionview collectionview) {     return 1; }  public override nint getitemscount(uicollectionview collectionview, nint section) {     return data.length; }  public override void itemselected (uicollectionview collectionview, nsindexpath indexpath) {     var message = string.format ("you clicked on {0}!", cell.title);     new uialertview ("clicked", message, null, "okay", null).show (); }  public override uicollectionviewcell getcell (uicollectionview collectionview, nsindexpath indexpath) {     cell = (mycollectioncell) collectionview.dequeuereusablecell ("my_collection_cell", indexpath);     var tag = data[indexpath.row];     cell.populatedata (tag.title, tag.thumbnailpath);     return cell; }  public override void itemhighlighted(uicollectionview collectionview, nsindexpath indexpath) {     var cell = collectionview.cellforitem(indexpath);     cell.contentview.backgroundcolor = uicolor.yellow; }  public override void itemunhighlighted(uicollectionview collectionview, nsindexpath indexpath) {     var cell = collectionview.cellforitem(indexpath);     cell.contentview.backgroundcolor = uicolor.white; }  public override bool shouldhighlightitem(uicollectionview collectionview, nsindexpath indexpath) {     return true; }  private models.dummymodel[] makedataforrecyclerview(int startposition) {     list<models.dummymodel> listof4item = new list<models.dummymodel>();      (int = startposition * 4; < math.min((4 * startposition) + 4, appdelegate.mylist.count); i++)     {         listof4item.add(appdelegate.mylist.elementat(i));     }      return listof4item.toarray(); } 

mycollectioncell

public mycollectioncell (intptr handle) : base (handle) {  }  public void populatedata(string title, string placeholderurl) {     //lbltitle.text = title;     placeholderimg.setimage(url: new nsurl(placeholderurl),                             placeholder: uiimage.fromfile("ic_apptitle.png")); } 

your problem in here:

public override nint numberofsections (uicollectionview collectionview) {     return 2; // should 1 not 2 } 

to set different sizes cells may add method:

public override sizef getsizeforitem (uicollectionview collectionview, uicollectionviewlayout layout, nsindexpath indexpath) {     // return size want cell @ indexpath }  

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -