Пример #1
0
            public void ReloadUI(QuestionListRow row, UITableView tableView)
            {
                var post = row._post;

                _text.Text    = post.TitleDecoded;
                _details.Text = BclEx.OffsetFromNow(post.creation_date) + " by";
                _author.SetData(row._controller, post.owner);
                _details2.Text = string.Format("{0}\uD83D\uDC4D  {1}\u2606  {2}\uD83D\uDC40  {3} answers  {4} comments", post.score, post.favorite_count, GetViewCount(post.view_count), post.answer_count, post.comments != null ? post.comments.Count : 0);

                if (post.tags != null)
                {
                    if (row.RichTags)
                    {
                        RichTags(post.tags, row);
                    }
                    else
                    {
                        PlainTags(post.tags);
                    }
                }

                float titleHeight = row.GetHeightTitle(tableView);

                _text.Frame         = new RectangleF(6, 0, tableView.Frame.Width - 24, titleHeight);
                _details.Frame      = new RectangleF(6, titleHeight, _details.StringSize(_details.Text, _details.Font).Width, 20);
                _author.Frame       = new RectangleF(_details.Frame.X + _details.Frame.Width + 4, titleHeight, _author.StringSize(_author.Text, _author.Font).Width, 20);
                _details2.Frame     = new RectangleF(6, 20 + titleHeight, tableView.Frame.Width - 24, 20);
                _richDetails2.Frame = new RectangleF(6, 40 + titleHeight, tableView.Frame.Width - 24, 20);
                _tags.Frame         = new RectangleF(6, 40 + titleHeight, tableView.Frame.Width - 24, 20);
            }
Пример #2
0
            private void RichTags(List <string> tags, QuestionListRow row)
            {
                foreach (var v in _richDetails2.Subviews.Skip(5))
                {
                    v.RemoveFromSuperview();
                    v.Dispose();
                }

                int existing        = _richDetails2.Subviews.Length;
                int existingCounter = 0;

                float offset = -2;

                foreach (string tag in tags)
                {
                    TagLabel label = null;

                    if (existingCounter < existing)
                    {
                        label = (TagLabel)_richDetails2.Subviews[existingCounter];
                        existingCounter++;
                    }
                    else
                    {
                        label = new TagLabel(row._controller);
                        _richDetails2.Add(label);
                    }

                    var size = label.StringSize(tag, label.Font);
                    label.Frame  = new RectangleF(offset + 2, 0, size.Width + 4, 20);
                    label.Text   = tag;
                    label.Hidden = false;

                    offset += size.Width + 8;
                }

                if (existingCounter < existing)
                {
                    for (int i = existingCounter; i < existing; i++)
                    {
                        _richDetails2.Subviews[i].Hidden = true;
                    }
                }
            }
Пример #3
0
            private void RichTags(List<string> tags, QuestionListRow row)
            {
                foreach (var v in _richDetails2.Subviews.Skip(5))
                {
                    v.RemoveFromSuperview();
                    v.Dispose();
                }

                int existing = _richDetails2.Subviews.Length;
                int existingCounter = 0;

                float offset = -2;
                foreach (string tag in tags)
                {
                    TagLabel label = null;

                    if (existingCounter < existing)
                    {
                        label = (TagLabel)_richDetails2.Subviews[existingCounter];
                        existingCounter++;
                    }
                    else
                    {
                        label = new TagLabel(row._controller);
                        _richDetails2.Add(label);
                    }

                    var size = label.StringSize(tag, label.Font);
                    label.Frame = new RectangleF(offset + 2, 0, size.Width + 4, 20);
                    label.Text = tag;
                    label.Hidden = false;

                    offset += size.Width + 8;
                }

                if (existingCounter < existing)
                {
                    for (int i = existingCounter; i < existing; i++)
                    {
                        _richDetails2.Subviews[i].Hidden = true;
                    }
                }
            }
Пример #4
0
            public void ReloadUI(QuestionListRow row, UITableView tableView)
            {
                var post = row._post;

                _text.Text = post.TitleDecoded;
                _details.Text = BclEx.OffsetFromNow(post.creation_date) + " by";
                _author.SetData(row._controller, post.owner);
                _details2.Text = string.Format("{0}\uD83D\uDC4D  {1}\u2606  {2}\uD83D\uDC40  {3} answers  {4} comments", post.score, post.favorite_count, GetViewCount(post.view_count), post.answer_count, post.comments != null ? post.comments.Count : 0);

                if (post.tags != null)
                {
                    if (row.RichTags)
                        RichTags(post.tags, row);
                    else
                        PlainTags(post.tags);
                }

                float titleHeight = row.GetHeightTitle(tableView);

                _text.Frame = new RectangleF(6, 0, tableView.Frame.Width - 24, titleHeight);
                _details.Frame = new RectangleF(6, titleHeight, _details.StringSize(_details.Text, _details.Font).Width, 20);
                _author.Frame = new RectangleF(_details.Frame.X + _details.Frame.Width + 4, titleHeight, _author.StringSize(_author.Text, _author.Font).Width, 20);
                _details2.Frame = new RectangleF(6, 20 + titleHeight, tableView.Frame.Width - 24, 20);
                _richDetails2.Frame = new RectangleF(6, 40 + titleHeight, tableView.Frame.Width - 24, 20);
                _tags.Frame = new RectangleF(6, 40 + titleHeight, tableView.Frame.Width - 24, 20);
            }