コード例 #1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            PublicationAnnotationCell cell = tableView.DequeueReusableCell(PublicationAnnotationCell.Key) as PublicationAnnotationCell;

            if (cell == null)
            {
                cell = PublicationAnnotationCell.Create();
            }
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            var     annotation = AnnoListDict [SectionTitleArr [indexPath.Section]] [indexPath.Row];
            UIColor TextColor  = ColorUtil.ConvertFromHexColorCode("#959595");

            DateTime date = annotation.UpdatedTime;

            cell.dateLabel.TextColor = TextColor;
            cell.dateLabel.Text      = date.ToString("dd MMM yyyy");

            cell.TocLabel.Text      = annotation.TOCTitle;
            cell.TocLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#000000");

            cell.conLabel.Text      = annotation.HighlightText;
            cell.conLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#000000");

            cell.imageIma.Image      = new UIImage("Images/Setting/About.png");
            cell.NoteLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
            if (annotation.NoteText != "")
            {
                cell.NoteLabel.Text = annotation.NoteText;
            }
            else
            {
                cell.NoteLabel.Text = "Add a note...";
            }

            nfloat TagHeight = (tableView.Frame.Size.Width - 60 * 4) / 5;

            getGuidList = annotation.CategoryTags;
            if (getGuidList.Count == 0)
            {
                UIView emptyBtn = new UIView(new CGRect(3, 5, 10, 10));
                emptyBtn.BackgroundColor    = UIColor.White;
                emptyBtn.Layer.BorderColor  = ColorUtil.ConvertFromHexColorCode("#cccccc").CGColor;
                emptyBtn.Layer.BorderWidth  = 1;
                emptyBtn.Layer.CornerRadius = 10 / 2;

                UILabel emptyLabel = new UILabel(new CGRect(25, 0, 120, 18));
                emptyLabel.Text      = "Add a tag...";
                emptyLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
                emptyLabel.Font      = UIFont.SystemFontOfSize(14);
                cell.bgView.AddSubview(emptyLabel);
                cell.bgView.AddSubview(emptyBtn);
            }
            else
            {
                for (int i = 0; i < getGuidList.Count; i++)
                {
                    AnnotationTag tag          = getGuidList [i];
                    UIColor       defaultColor = ColorUtil.ConvertFromHexColorCode(tag.Color);
                    TagsButton    btn          = new TagsButton();
                    btn.Frame                     = new CGRect((TagHeight + 60) * (i % 4) - 15 + TagHeight, (i / 4) * 25, 60, 30);
                    btn.BackgroundColor           = UIColor.White;
                    btn.ColorView.BackgroundColor = defaultColor;
                    btn.ColorLabel.Text           = tag.Title;
                    cell.bgView.AddSubview(btn);
                }
            }
            return(cell);
        }
コード例 #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            CustomizedAnnotationTableViewCell cell = tableView.DequeueReusableCell(CustomizedAnnotationTableViewCell.Key) as CustomizedAnnotationTableViewCell;

            if (cell == null)
            {
                cell = CustomizedAnnotationTableViewCell.Create();
            }
            cell.SelectionStyle = UITableViewCellSelectionStyle.None;

            if (AnnotationList.Count != 0)
            {
                var annotation = AnnotationList[indexPath.Row];

                cell.PublicationNameLabel.Text = annotation.BookTitle;
                DateTime date = annotation.UpdatedTime;

                cell.DateLabel.Text = date.ToString("dd MMM yyyy");
                string guidCardTitle = annotation.GuideCardName + ">" + annotation.TOCTitle;
                cell.GuidecardLabel.Text     = guidCardTitle;
                cell.HighlightTextLabel.Text = annotation.HighlightText;

                cell.NoteLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
                if (annotation.NoteText != "")
                {
                    cell.NoteLabel.Text = annotation.NoteText;
                }
                else
                {
                    cell.NoteLabel.Text = "Add a note...";
                }
                getGuidList = annotation.CategoryTags;
                nfloat TagHeight = (tableView.Frame.Size.Width - 60 * 8) / 9;
                if (getGuidList.Count == 0)
                {
                    UIView emptyBtn = new UIView(new CGRect(0, 10, 10, 10));
                    emptyBtn.BackgroundColor    = UIColor.White;
                    emptyBtn.Layer.BorderColor  = ColorUtil.ConvertFromHexColorCode("#cccccc").CGColor;
                    emptyBtn.Layer.BorderWidth  = 1;
                    emptyBtn.Layer.CornerRadius = 10 / 2;

                    UILabel emptyLabel = new UILabel(new CGRect(18, 5, 120, 18));
                    emptyLabel.Text      = "Add a tag...";
                    emptyLabel.TextColor = ColorUtil.ConvertFromHexColorCode("#cccccc");
                    emptyLabel.Font      = UIFont.SystemFontOfSize(14);
                    cell.TagContainerView.AddSubview(emptyLabel);
                    cell.TagContainerView.AddSubview(emptyBtn);
                }
                else
                {
                    for (int i = 0; i < getGuidList.Count; i++)
                    {
                        AnnotationTag tag          = getGuidList[i];
                        UIColor       defaultColor = ColorUtil.ConvertFromHexColorCode(tag.Color);
                        TagsButton    btn          = new TagsButton();
                        btn.Frame                     = new CGRect((TagHeight + 60) * (i % 8), (i / 8) * 25, 60, 30);
                        btn.BackgroundColor           = UIColor.White;
                        btn.ColorView.BackgroundColor = defaultColor;
                        btn.ColorLabel.Text           = tag.Title;
                        btn.Layer.BorderColor         = UIColor.Clear.CGColor;
                        btn.Layer.BorderWidth         = 1;
                        btn.Layer.CornerRadius        = 10 / 2;
                        btn.ClipsToBounds             = true;
                        cell.TagContainerView.AddSubview(btn);
                    }
                }
            }

            cell.Accessory = UITableViewCellAccessory.DisclosureIndicator;
            return(cell);
        }