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