Thank you Craig.  That is the piece that I was missing.  I was confused over 
the use of the RefreshControl property since I had seen it done several 
different ways.

Wally

Date: Thu, 13 Dec 2012 11:52:16 -0800
Subject: Re: [MonoTouch] UIRefreshControl & UITableView
From: [email protected]
To: [email protected]
CC: [email protected]

Wally,
I don't see you assigning the UIRefreshControl you created to the UITableView's 
RefreshControl property. You've got a local var refresh but unless the table 
view itself has the widget assigned, it won't work... you could probably just 
ditch your field and assign to the TableView.RefreshControl property directly?

cd

On Thu, Dec 13, 2012 at 11:46 AM, Wally McClure <[email protected]> 
wrote:





I am trying to get the UIRefreshControl to work in a UITableView.  I've been 
reading the content at Craig Dunn's blog on the UIRefreshControl.  It would 
seem to me that I would need to add a UIRefreshControl into the 
UITableViewController.  Unfortunately, that is a no go.  I don't seem to get 
the effect that I am looking for as the HandleValueChanged event is never 
called.  What do I need to do to go about using the UIRefreshControl and a 
UITableView?


    public class MyTableController : UITableViewController

    {
        TwitterSearch ts;

        UIRefreshControl refresh;

        public MyTableController ()

        {
        }

        public override void ViewDidLoad ()

        {

            base.ViewDidLoad ();

        }

        public override void ViewDidAppear (bool animated)

        {
            base.ViewDidAppear (animated);

            ts = new TwitterSearch();

            ts.StartSearch("MonoTouch", new AsyncCallback(ProcessResult));

            refresh = new UIRefreshControl ();

            refresh.ValueChanged += HandleValueChanged;

        }

        void HandleValueChanged (object sender, EventArgs e)

        {
            Console.WriteLine ("HandleValueChanged");

            ts.StartSearch("MonoTouch", new AsyncCallback(ProcessResult));


        }

        void RefreshData(IAsyncResult iar)

        {

            List<Tweet> twtL = ts.ProcessRestXmlLINQHttpResponse (iar);

            var td = new TweetListData (twtL);

            InvokeOnMainThread (delegate {

                TableView.DataSource = td;

                TableView.ReloadData ();
                if ( refresh.Refreshing )

                {
                    refresh.EndRefreshing();

                }
            });
        }

        void ProcessResult(IAsyncResult iar){

            RefreshData (iar);
        }


    }

                                          

_______________________________________________

MonoTouch mailing list

[email protected]

http://lists.ximian.com/mailman/listinfo/monotouch



                                          
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to