public ViewDataSource(UITableView tableView) { Random rnd = new Random(); sections = UILocalizedIndexedCollation.CurrentCollation().SectionIndexTitles; testArray = ( from section in sections group section by section into g select( from i in Enumerable.Range(1, rnd.Next(5) + 1) select i.ToString() ).ToList() ).ToArray(); cellDelegate = new CellDelegate(testArray, tableView); }
public override void ViewDidLoad() { base.ViewDidLoad(); // set up the data Random rnd = new Random(); sections = UILocalizedIndexedCollation.CurrentCollation().SectionIndexTitles; testArray = ( from section in sections group section by section into g select Enumerable.Range(1, rnd.Next(5) + 1).Select(i => i.ToString()).ToList() ).ToArray(); cellDelegate = new CellDelegate(testArray, TableView); NavigationItem.LeftBarButtonItem = EditButtonItem; TableView.RowHeight = 90; NavigationItem.Title = "Pull to Toggle Cell Type"; // Setup refresh control for example app UIRefreshControl refreshControl = new UIRefreshControl(); refreshControl.ValueChanged += (sender, args) => { refreshControl.BeginRefreshing(); useCustomCells = !useCustomCells; if (useCustomCells) { RefreshControl.TintColor = UIColor.Yellow; } else { RefreshControl.TintColor = UIColor.Blue; } TableView.ReloadData(); refreshControl.EndRefreshing(); }; refreshControl.TintColor = UIColor.Blue; TableView.AddSubview(refreshControl); RefreshControl = refreshControl; useCustomCells = false; }