Would someone be able to post a Monotouch version of the cell reordering example from the Nuclios samples (complete with images).
Thanks
Here's a quick example I threw together showing cell reordering using MonoTouch. The code is so short, I don't think any beautiful illustrations are necessary.
namespace CellReorderingSample{ public partial class CellReorderingSampleViewController : UIViewController { IGGridView _gridView; IGGridViewDataSourceHelper _dsh; IGGridViewSingleFieldMultiColumnDataSourceHelper _ds; List<NSObject> _data = new List<NSObject>(); public CellReorderingSampleViewController () {} public override void ViewDidLoad () { base.ViewDidLoad (); this.View.BackgroundColor = UIColor.White; GenerateData(); _gridView = new IGGridView(this.View.Bounds, IGGridViewStyle.IGGridViewStyleDefault); _gridView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth|UIViewAutoresizing.FlexibleHeight; _gridView.SelectionType = IGGridViewSelectionType.IGGridViewSelectionTypeCell; _gridView.HeaderHeight = 0; this.View.Add(_gridView); IGGridViewColumnDefinition column = new IGGridViewColumnDefinition("Name"); _ds = new IGGridViewSingleFieldMultiColumnDataSourceHelper(column); _ds.NumberOfColumns = 4; _ds.Data = _data.ToArray(); _ds.AllowCellReordering = true; _dsh = _ds; _gridView.DataSource = _ds; } public void GenerateData() { for (int i = 1; i < 26; i++) { Employee newEmployee = new Employee(); newEmployee.Name = "Employee #" + i.ToString(); _data.Add(newEmployee); } } } public class Employee : NSObject { [Export("Name")] public String Name {get; set;} public Employee() {} }}
Unrelated question for you, are you any relation to Richard Davey that worked for The Game Creators some years ago?
Hey there,
No relation to Richard I'm afraid :)
Thanks for the example above; how do you customize this with a custom cell? For example, if my datasource had 2 text fields and an image (so each daat point would have different text and a different graphic from bundle) how would I amend the above to incorporate that?
Hi Richard,
Thats no problem, you'll just need to create a custom column and a custom cell.
The code above explains how to create a custom column and cell. Note in this case i just added another label, however you could add whatever you want in there.
Then to use this code:
And thats it.
Hope this helps,
-SteveZ
Thanks for the examples guys. I have put them together (link to download is here: https://www.dropbox.com/s/a1bc6w3xwf28n25/example.zip ) However, dragging around works fine, until you drag something in to the second column of the last row, and then you get an error around array out of bounds?
Hmm... unfortunately it looks like you found a bug.
However, there is a pretty simple workaround that you can use until the next Service Release.
All you need to do is use the IGGridViewDelegate. We're going to do a simple check and see if the proposedPath is valid. If it's not, we're simply going to return a valid path.
Then all you need to do is use the custom delegate.
And thats it!
Sorry for the inconvenience. But thank you for bringing it to our attention.