示例#1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            TableView = new UITableView(new CGRect(0, 20, View.Frame.Width, View.Frame.Height - 30));
            string[] tableItems = new string[] { "Vegetables", "Fruits", "Flower Buds", "Legumes", "Bulbs", "Tubers" };
            Source = new TableSource(tableItems, TableView);
            this.TableView.Source = Source;
            // Perform any additional setup after loading the view, typically from a nib.

            View.AddSubview(TableView);

            var addBtn = new UIButton(new CGRect(20, 100, 100, 44));

            addBtn.SetTitle("Add", UIControlState.Normal);
            addBtn.SetTitleColor(UIColor.Orange, UIControlState.Normal);
            addBtn.TouchUpInside += (s, e) =>
            {
                Source.Add("TestData : " + r.Next(1000, 10000));
            };

            View.AddSubview(addBtn);
            TableView.AddLegendHeaderWithRefreshingBlock(() =>
            {
                for (int i = 0; i < 10; i++)
                {
                    Source.Add("TestData : " + r.Next(1000, 10000));
                }
                TableView.HeaderEndRefreshing();
            });
        }