Hi!

I'm working with someone developing a pretty neat component, that might be
submitted to the Xamarin component store later (or not, it's not entirely up
to me). Without going into specifics, the end user will implement the
component together with an existing UIScrollView, where it will listen to
its scroll event. That's easy enough right? Well, not quite.

In a perfect world the component would work like this:

  var target = new SomeUIScrollView();
  var component = new Component(target);

and in the constructor we'd simply do 

  target.Scrolled += magic(this, EventArgs.Empty);


However... the above doesn't work if the UIScrollView is using an
UIScrollViewDelegate. So, next idea was to do

  class Component : UIScrollViewDelegate
  {
    public override void Scrolled(UIScrollView scrollView)
    {
      magic(this, EventArgs.Empty);
    }
   ...

and then the user would have to use or inherit from Component as their
UIScrollViewDelegate and make sure to call the base methods if they
themselves would override Scrolled.

However... the above doesn't work if the user is using the event syntax.


Question: As a third party library, how do you support both methods? If it's
not possible, should we go with the event syntax (which feels very .NET) or
instead implement it as an UIScrollViewDelegate (which feels more iOS)?

 / V



--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/How-do-you-actually-listen-to-an-UIScrollView-scrolling-tp4658518.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to