Have implemented pull to refresh behaviour with no problem (iOS on Xamarin).
I need to display an alert controller (to display the number of records loaded) and I cannot do that from the delegate as far as I know.
Also cannot wire up to another event of the grid to do this display.
Any other way to do this ?
Hi,
So, on the IGGridView, when you've got your data to display, you're calling gridView.FinishedUpdating(), right? That would probably be the best time to display you're alert.
-SteveZ
Steve,
That code is executing in the pull to refresh method of the grid delegate which is a separate class from the view controller class. That is the problem.
Ah ok,
So the trick that most people use for this situation is to pass a reference of your ViewController to the delegate, either in the constructor or maybe as a settable property. In objective-c a delegate is more like an interface, so you can implement on your ViewController directly. But with Xamarin they make all protocols a separate object, which can make it a bit more difficult to work with.
But I cannot change the signature of the methods supplied in the delegate interface. And I do not have a constructor for the delegate class; Grid's delegate property expects an out of the box interface based class. Maybe I am misunderstading you. Can you please show me a code example ?
Sure. I'm just suggesting you add a reference to your ViewController on your custom IGGridViewDelegate. So in the sample, i override IGGridViewDelegate, and add a constructor that takes a reference to my ViewController.
public partial class ViewController : UIViewController { public override void ViewDidLoad () { base.ViewDidLoad (); IGGridView gridView = new IGGridView (this.View.Bounds, IGGridViewStyle.IGGridViewStyleDefault); gridView.Delegate = new MyDelegate (this); this.View.AddSubview (gridView); } } public class MyDelegate : IGGridViewDelegate { ViewController _vc; public MyDelegate(ViewController vc) { _vc = vc; } }
Hope this helps,
Got it. Too much caffeine. Thanks.