Beispiel #1
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;
                    }
                }
            }
            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;
                    }
                }
            }