public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); dbItems = Sqlite.getData(true); Console.WriteLine("frame: " + table.Frame.Size.Height + " constraint: " + tableHeight.Constant); tableHeight.Constant = (table.Frame.Size.Height - (dbItems.Count * 55) > 0) ? (table.Frame.Size.Height - (dbItems.Count * 55)) + 25 : tableHeight.Constant; Console.WriteLine("frame: " + table.Frame.Size.Height + "constraint: " + tableHeight.Constant); table.Source = new TableView(this, dbItems); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. dbItems = new List <Hashtable>(); //Get the data from the DB dbItems = Sqlite.getData(false); //Subscribed Feed links tableView linksTableView.Source = new SubscribeTableView(dbItems); linksTableView.Layer.BorderColor = UIColor.FromRGB(3, 151, 215).CGColor; linksTableView.Layer.BorderWidth = 1; linksTableView.ContentInset = UIEdgeInsets.Zero; //(0, -15, 0, 0); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UIButton button = new UIButton(); // request a recycled cell to save memory UITableViewCell cell = tableView.DequeueReusableCell(identifier); // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Subtitle, identifier); //Add a button button = new UIButton(new CGRect(cell.Frame.Size.Width - 60, 10, 90, 30)); button.BackgroundColor = UIColor.Clear; button.SetTitleColor(UIColor.FromRGB(3, 151, 215), UIControlState.Normal); button.Layer.CornerRadius = 5; button.Layer.BorderColor = UIColor.FromRGB(3, 151, 215).CGColor; button.Layer.BorderWidth = 1; button.Tag = indexPath.Row; button.TouchUpInside += (object sender, EventArgs e) => { int n = Int32.Parse(((sender as UIButton).Tag).ToString()); if (getSubscribtionStatus(list[n]) == "0") { Sqlite.updateFeed(getValue(list[n]), 1); button.SetTitle("Following", UIControlState.Normal); } else { Sqlite.updateFeed(getValue(list[n]), 0); button.SetTitle("Follow", UIControlState.Normal); } list = Sqlite.getData(false); }; cell.AddSubview(button); } else { Array subviews = cell.Subviews; foreach (UIView v in subviews) { if (v.GetType() == typeof(UIButton)) { button = v as UIButton; button.SetTitle("", UIControlState.Normal); button.Tag = indexPath.Row; } } } cell.TextLabel.Text = "LinkFeed " + (indexPath.Row + 1); cell.DetailTextLabel.Text = getValue(this.list[indexPath.Row]); if (getSubscribtionStatus(list[indexPath.Row]) == "1") { button.SetTitle("Following", UIControlState.Normal); } else { button.SetTitle("Follow", UIControlState.Normal); } return(cell); }