public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { CustomizeTagTableViewCell cell = tableView.DequeueReusableCell(CustomizeTagTableViewCell.Key) as CustomizeTagTableViewCell; if (cell == null) { cell = CustomizeTagTableViewCell.Create(); } cell.SelectionStyle = UITableViewCellSelectionStyle.None; if (indexPath.Row == 0) { cell.TagNameLabel.Text = "All Tags"; cell.ContentView.AddSubview(new AllTagView(12, 10, 16)); bool isAllSelected = isNoTagSelected; if (isAllSelected) { foreach (var tag in tagList) { if (!tag.IsSelected) { isAllSelected = false; break; } } } cell.Accessory = isAllSelected ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; } else if (indexPath.Row == 1) { cell.ContentView.Add(new DoubleCircleView(4, 5, UIColor.White, ColorUtil.ConvertFromHexColorCode("#808080"), 16, 17)); cell.TagNameLabel.Text = "No tag"; cell.Accessory = isNoTagSelected ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; } else { Tag tag = tagList [indexPath.Row - 2]; cell.ContentView.Add(new DoubleCircleView(5, 6, ColorUtil.ConvertFromHexColorCode(tag.AnnoTag.Color), UIColor.White, 15, 16)); cell.TagNameLabel.Text = tag.AnnoTag.Title; cell.Accessory = tag.IsSelected? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None; } return(cell); }
public override void MoveRow(UITableView tableView, NSIndexPath sourceIndexPath, NSIndexPath destinationIndexPath) { List <AnnotationTag> tagIdList = new List <AnnotationTag> (); foreach (var annotationTag in TagList) { tagIdList.Add(annotationTag.AnnoTag); } CustomizeTagTableViewCell sourceCell = (CustomizeTagTableViewCell)tableView.CellAt(sourceIndexPath); CustomizeTagTableViewCell dexCell = (CustomizeTagTableViewCell)tableView.CellAt(destinationIndexPath); int sourceIndexAtTagIdList = tagIdList.IndexOf(sourceCell.annotationTagId); int desIndexAtTagIdList = tagIdList.IndexOf(dexCell.annotationTagId); tagIdList.RemoveAt(sourceIndexAtTagIdList); tagIdList.Insert(desIndexAtTagIdList, sourceCell.annotationTagId); AnnCategoryTagUtil.Instance.Sort(tagIdList); tableView.ReloadData(); NSNotificationCenter.DefaultCenter.PostNotificationName("RefreshTagTableView", this); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { CustomizeTagTableViewCell cell = tableView.DequeueReusableCell(CustomizeTagTableViewCell.Key) as CustomizeTagTableViewCell; if (cell == null) { cell = CustomizeTagTableViewCell.Create(); } cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; Tag tag = TagList[indexPath.Row]; cell.annotationTagId = tag.AnnoTag; cell.ContentView.Add(new DoubleCircleView(5, 6, ColorUtil.ConvertFromHexColorCode(tag.AnnoTag.Color), UIColor.White, 15, 16)); cell.TagNameLabel.Text = tag.AnnoTag.Title; return(cell); }