Exemple #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var r         = new Random();
            var generator = new LoremIpsumGenerator();

            items = new NSMutableArray();
            for (int i = 0; i < 20; i++)
            {
                items.Add(new NSString(generator.GenerateString(2 + r.Next(30))));
            }

            dataSource = new TKDataSource(items);
            dataSource.Settings.ListView.DefaultCellClass = new ObjCRuntime.Class(typeof(ListViewVariableSizeCell));
            dataSource.Settings.ListView.InitCell((TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) => {
                var myCell        = cell as ListViewVariableSizeCell;
                myCell.label.Text = item.Description;
            });

            var list = new TKListView(this.View.Bounds);

            list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            list.WeakDataSource   = dataSource;
            this.View.AddSubview(list);

            var layout = list.Layout as TKListViewLinearLayout;

            layout.DynamicItemSize = true;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            var r = new Random ();
            var generator = new LoremIpsumGenerator ();
            items = new NSMutableArray ();
            for (int i = 0; i < 20; i++) {
                items.Add (new NSString(generator.GenerateString (2 + r.Next (30))));
            }

            dataSource = new TKDataSource (items);
            dataSource.Settings.ListView.DefaultCellClass = new ObjCRuntime.Class (typeof(ListViewVariableSizeCell));
            dataSource.Settings.ListView.InitCell ((TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) => {
                var myCell = cell as ListViewVariableSizeCell;
                myCell.label.Text = item.Description;
            });

            var list = new TKListView (this.View.Bounds);
            list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            list.WeakDataSource = dataSource;
            this.View.AddSubview (list);

            var layout = list.Layout as TKListViewLinearLayout;
            layout.DynamicItemSize = true;
        }
 public ListViewDataSource()
 {
     var random = new Random();
     var generator = new LoremIpsumGenerator();
     for (int i = 0; i<10000; i++) {
         items.Add(generator.GenerateString(3 + random.Next(50) + random.Next(30)));
     }
 }
Exemple #4
0
            public ListViewDataSource()
            {
                var random    = new Random();
                var generator = new LoremIpsumGenerator();

                for (int i = 0; i < 10000; i++)
                {
                    items.Add(generator.GenerateString(3 + random.Next(50) + random.Next(30)));
                }
            }