コード例 #1
0
        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);
        }
コード例 #2
0
        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
            Sqlite.GetConnection();

            //Subscribed Feed links tableView
//			table.Source = new TableView(this, dbItems);
            table.Layer.BorderColor = UIColor.FromRGB(3, 151, 215).CGColor;
            table.Layer.BorderWidth = 1;
            table.ContentInset      = UIEdgeInsets.Zero;       //(0, -15, 0, 0);

            //Subscribe to more links
            subscribeButton.Layer.CornerRadius = 5;
            subscribeButton.TouchUpInside     += (object sender, EventArgs e) => {
                PerformSegue("subscribeSegue", this);
            };
        }
コード例 #3
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);
        }