// Handle supported edits to the data source (inserts and deletes) public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, NSIndexPath indexPath) { // Respond to the user's edit request: Insert a new statistic definition, or delete an existing one if (editingStyle == UITableViewCellEditingStyle.Insert) { // Get the bounds of the table CGRect ovBounds = tableView.Bounds; ovBounds.Height = ovBounds.Height + 60; // Create an overlay UI that lets the user choose a field and statistic type to add _chooseStatOverlay = new ChooseStatisticOverlay(ovBounds, 0.70f, UIColor.White, _statPicker); // Handle the OnStatisticDefined event to get the info entered by the user _chooseStatOverlay.OnStatisticDefined += (s, statDef) => { // Verify the selected statistic doesn't exist in the collection (check for an alias with the same value) StatisticDefinition existingItem = _statisticDefinitions.Find(itm => itm.OutputAlias == statDef.OutputAlias); if (existingItem != null) { return; } // Make updates to the table (add the chosen statistic) tableView.BeginUpdates(); // Insert a new row at the top of table display tableView.InsertRows(new NSIndexPath[] { NSIndexPath.FromRowSection(0, 0) }, UITableViewRowAnimation.Fade); // Insert the chosen statistic in the underlying collection _statisticDefinitions.Insert(0, statDef); // Apply table edits tableView.EndUpdates(); }; // Handle when the user chooses to close the dialog _chooseStatOverlay.OnCanceled += (s, e) => { // Remove the item input UI _chooseStatOverlay.Hide(); _chooseStatOverlay = null; }; // Add the picker UI view (will display semi-transparent over the table view) tableView.Add(_chooseStatOverlay); } else if (editingStyle == UITableViewCellEditingStyle.Delete) { // Remove the selected row from the table and the underlying collection of statistic definitions _statisticDefinitions.RemoveAt(indexPath.Row); tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); } }
private void StyleTable() { table = new UITableView(new CGRect(0, fmCalendar.Frame.GetMaxY() - 64, View.Frame.Width, View.Frame.Height - fmCalendar.Frame.GetMaxY() + 64)) { BackgroundColor = UIColor.White, SeparatorColor = UIColor.Clear }; table.Add(new UIView(new CGRect(0, 0, View.Frame.Width, 2)) { BackgroundColor = Util.BackgroundGrey }); View.Add(table); }
private void AddStringContent(Object sender, EventArgs e) { random.Add("Hi"); random.Add("there"); random.Add(","); random.Add("how"); random.Add("are"); random.Add("you"); random.Add("?"); foreach (string value in random) { _listStringView.Add(_listClassView); } }
public override async void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. Title = "Pull to Refresh Sample"; table = new UITableView(new CGRect(0, 20, View.Bounds.Width, View.Bounds.Height - 20)); //table.AutoresizingMask = UIViewAutoresizing.All; tableItems = new List <TableItem>(); tableItems.Add(new TableItem("Vegetables") { ImageName = "Vegetables.jpg" }); tableItems.Add(new TableItem("Fruits") { ImageName = "Fruits.jpg" }); tableItems.Add(new TableItem("Flower Buds") { ImageName = "Flower Buds.jpg" }); tableItems.Add(new TableItem("Legumes") { ImageName = "Legumes.jpg" }); tableItems.Add(new TableItem("Tubers") { ImageName = "Tubers.jpg" }); tableSource = new TableSource(tableItems); table.Source = tableSource; await RefreshAsync(); AddRefreshControl(); Add(table); table.Add(RefreshControl); }
public override async void ViewDidLoad() { base.ViewDidLoad(); var btn = new UIButton(UIButtonType.Custom); btn.Frame = new CGRect(0, 0, 0, 0); showIndicator(); btn.SetImage(UIImage.FromBundle("barlogo"), UIControlState.Normal); btn.ContentMode = UIViewContentMode.ScaleAspectFit; searchBar = new UISearchBar() { Placeholder = " ", Prompt = " ", ShowsScopeBar = true }; searchBar.SizeToFit(); searchBar.AutocorrectionType = UITextAutocorrectionType.No; searchBar.AutocapitalizationType = UITextAutocapitalizationType.None; searchBar.ReturnKeyType = UIReturnKeyType.Done; searchBar.EnablesReturnKeyAutomatically = false; searchBar.SearchButtonClicked += (sender, e) => { // Search(); }; searchBar.TextChanged += (sender, e) => { //this is the method that is called when the user searches searchTable(); }; searchBar.CancelButtonClicked += (sender, e) => { searchBar.ResignFirstResponder(); }; searchBar.SelectedScopeButtonIndexChanged += (sender, e) => { searchBar.ResignFirstResponder(); }; searchBar.SearchButtonClicked += (sender, e) => { // searchTable(); searchBar.ResignFirstResponder(); }; this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(btn), true); this.NavigationItem.TitleView = searchBar; if (Reachability.IsHostReachable("https://newcities-newurban.firebaseio.com")) { getNews gn = new getNews(); allnews = await gn.GetAllNews(); if (allnews != null) { table = new UITableView(new CGRect(0, 20, View.Bounds.Width - 5, View.Bounds.Height - 20)); table.AutoresizingMask = UIViewAutoresizing.All; table.RowHeight = 300f; table.EstimatedRowHeight = 300f; // defaults to Plain style table.Source = new ListsPhotoModelSource(allnews.ToArray(), this, ""); await RefreshAsync(); AddRefreshControl(); //table.TableHeaderView = searchBar; Add(table); hideIndicator(); table.Add(RefreshControl); } else { var alrt = UIAlertController.Create("Nuca", "يرجي التاكد من الاتصال بالانترنت", UIAlertControllerStyle.Alert); alrt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(alrt, true, null); } } else { PhotoModel pm = new PhotoModel(); pm.id = 0; pm.title = "يرجي التاكد من الاتصال بالانترنت"; pm.image = ""; pm.date = DateTime.Today.ToShortDateString(); pm.dayx = ""; pm.longdesc = ""; // allnews.Add(pm); var alrt = UIAlertController.Create("Nuca", "يرجي التاكد من الاتصال بالانترنت", UIAlertControllerStyle.Alert); alrt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(alrt, true, null); hideIndicator(); } }
public override async void ViewDidLoad() { base.ViewDidLoad(); var btn = new UIButton(UIButtonType.Custom); btn.Frame = new CGRect(0, 0, 40, 40); btn.SetImage(UIImage.FromBundle("barlogo"), UIControlState.Normal); showIndicator(); searchBar = new UISearchBar() { Placeholder = " ", Prompt = " ", ShowsScopeBar = true }; searchBar.SizeToFit(); searchBar.AutocorrectionType = UITextAutocorrectionType.No; searchBar.AutocapitalizationType = UITextAutocapitalizationType.None; searchBar.ReturnKeyType = UIReturnKeyType.Done; searchBar.EnablesReturnKeyAutomatically = false; this.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem(btn), true); this.NavigationItem.TitleView = searchBar; searchBar.SearchButtonClicked += (sender, e) => { // Search(); }; searchBar.TextChanged += (sender, e) => { //this is the method that is called when the user searches searchTableAsync(); }; searchBar.CancelButtonClicked += (sender, e) => { searchBar.ResignFirstResponder(); }; searchBar.SelectedScopeButtonIndexChanged += (sender, e) => { searchBar.ResignFirstResponder(); }; searchBar.SearchButtonClicked += (sender, e) => { // searchTable(); searchBar.ResignFirstResponder(); }; searchBar.CancelButtonClicked += (sender, e) => { searchBar.ResignFirstResponder(); }; searchBar.SelectedScopeButtonIndexChanged += (sender, e) => { searchBar.ResignFirstResponder(); }; searchBar.SearchButtonClicked += (sender, e) => { // searchTable(); searchBar.ResignFirstResponder(); }; getInvests gn = new getInvests(); List <InvestsModel> allnews = await gn.GetAllNews(); if (allnews != null) { table = new UITableView(new CGRect(0, 20, View.Bounds.Width - 5, View.Bounds.Height - 20)); table.AutoresizingMask = UIViewAutoresizing.All; table.RowHeight = 120f; table.EstimatedRowHeight = 120f; table.Source = new ListsInvistsModelSource(allnews.ToArray(), this, ""); await RefreshAsync(); AddRefreshControl(); //table.TableHeaderView = searchBar; Add(table); hideIndicator(); table.Add(RefreshControl); } else { var alrt = UIAlertController.Create("Nuca", "يرجي التاكد من الاتصال بالانترنت", UIAlertControllerStyle.Alert); alrt.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); PresentViewController(alrt, true, null); hideIndicator(); } }