public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.White; table = new UITableView(); table.Frame = new CoreGraphics.CGRect(0, 40, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 64 - 40); table.DataSource = new TableDataSource(this); table.Delegate = new TableDelegate(this); this.View.AddSubview(table); MJRefreshNormalHeader header = new MJRefreshNormalHeader(); table.SetHeader(header); MJRefreshAutoNormalFooter footer = new MJRefreshAutoNormalFooter(); table.SetFooter(footer); header.RefreshingBlock = async() => { await Task.Delay(2000); InvokeOnMainThread(() => { footer.Hidden = true; this.Count += 12; table.ReloadData(); table.Header().EndRefreshing(); footer.Hidden = false; }); }; header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderIdleText"), MJRefreshState.Idle); header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderPullingText"), MJRefreshState.Pulling); header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderRefreshingText"), MJRefreshState.Refreshing); header.AutomaticallyChangeAlpha = true; footer.RefreshingBlock = async() => { await Task.Delay(2000); InvokeOnMainThread(() => { footer.Hidden = true; this.Count += 5; table.ReloadData(); table.Footer().EndRefreshing(); footer.Hidden = false; }); }; footer.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshAutoFooterIdleText"), MJRefreshState.Idle); footer.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshAutoFooterRefreshingText"), MJRefreshState.Refreshing); footer.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshAutoFooterNoMoreDataText"), MJRefreshState.NoMoreData); table.Header().BeginRefreshing(); // Perform any additional setup after loading the view, typically from a nib. }
public override void ViewDidLoad() { base.ViewDidLoad(); this.TableView.Frame = new CoreGraphics.CGRect(0, 40, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 64 - 40); MJChiBaoZiHeader header = new MJChiBaoZiHeader(); this.TableView.SetHeader(header); MJRefreshAutoNormalFooter footer = new MJRefreshAutoNormalFooter(); this.TableView.SetFooter(footer); header.RefreshingBlock = async() => { await Task.Delay(2000); InvokeOnMainThread(() => { footer.Hidden = true; this.Count += 12; this.TableView.ReloadData(); this.TableView.Header().EndRefreshing(); footer.Hidden = false; }); }; header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderIdleText"), MJRefreshState.Idle); header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderPullingText"), MJRefreshState.Pulling); header.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshHeaderRefreshingText"), MJRefreshState.Refreshing); header.AutomaticallyChangeAlpha = true; footer.RefreshingBlock = async() => { await Task.Delay(2000); InvokeOnMainThread(() => { footer.Hidden = true; this.Count += 5; this.TableView.ReloadData(); this.TableView.Footer().EndRefreshing(); footer.Hidden = false; }); }; footer.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshAutoFooterIdleText"), MJRefreshState.Idle); footer.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshAutoFooterRefreshingText"), MJRefreshState.Refreshing); footer.SetTitle(NSBundle_MJRefresh.Mj_localizedStringForKey(NSBundle_MJRefresh.Mj_refreshBundle(NSBundle.MainBundle), "MJRefreshAutoFooterNoMoreDataText"), MJRefreshState.NoMoreData); this.TableView.Header().BeginRefreshing(); }