private void UpdateSelectionForCell(UICollectionViewCell cell)
        {
            bool isSelected = cell.Selected;

            UIImageView imageView = (UIImageView)cell.ViewWithTag(999);

            imageView.Layer.BorderColor = View.TintColor.CGColor;
            imageView.Layer.BorderWidth = isSelected ? 2 : 0;

            UILabel label = (UILabel)cell.ViewWithTag(998);

            label.TextColor = isSelected ? View.TintColor : UIColor.White;
        }
Example #2
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            string label = Data[indexPath.Section][indexPath.Row];
            UICollectionViewCell cell = (UICollectionViewCell)collectionView.DequeueReusableCell(cellIndentifier, indexPath);

            UILabel titleLabel = (UILabel)cell.ViewWithTag(100);

            titleLabel.Text = label;
            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            UICollectionViewCell cell = (UICollectionViewCell)CollectionView.DequeueReusableCell(reuseIdentifier, indexPath);

            UIImageView image = (UIImageView)cell.ViewWithTag(1);

            image.Image = UIImage.FromBundle(list[indexPath.Row].Key);

            UILabel label = (UILabel)cell.ViewWithTag(2);

            label.Text = list[indexPath.Row].Value;

            cell.Layer.MasksToBounds = false;
            cell.Layer.ShadowOffset  = new CoreGraphics.CGSize(0, 1);
            cell.Layer.ShadowRadius  = 1;
            cell.Layer.ShadowColor   = UIColor.Black.CGColor;
            cell.Layer.ShadowOpacity = 0.2f;

            return(cell);
        }
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            UICollectionViewCell cell = (UICollectionViewCell)collectionView.DequeueReusableCell("textReuseCell", indexPath);

            cell.BackgroundColor = UIColor.Clear;

            UIButton label  = (UIButton)cell.ViewWithTag(500);
            UIButton labelX = (UIButton)cell.ViewWithTag(510);

            labelX.TouchUpInside += (sender, e) =>
            {
                if (controller.TypesIndexPath != indexPath)
                {
                    HighlightCell(label, labelX, collectionView, indexPath);
                }
            };

            label.TouchUpInside += (sender, e) =>
            {
                if (controller.TypesIndexPath != indexPath)
                {
                    HighlightCell(label, labelX, collectionView, indexPath);
                }
            };

            label.SetTitle(string.Empty, UIControlState.Normal);
            labelX.SetTitle(string.Empty, UIControlState.Normal);

            Control item = samplesCollections.GetItem <Control>((nuint)indexPath.Row);

            NSString sampleName = item.Name;
            NSString dispName   = item.DisplayName;

            dispName = string.IsNullOrEmpty(dispName) ? sampleName : dispName;

            UIImageView tag = (UIImageView)cell.ViewWithTag(502);

            if (item.Tag == "NEW")
            {
                label.SetTitle(dispName, UIControlState.Normal);
                tag.Image = UIImage.FromBundle("Controls/Tags/x_new.png");
            }
            else if (item.Tag == "UPDATED")
            {
                label.SetTitle(dispName, UIControlState.Normal);
                tag.Image = UIImage.FromBundle("Controls/Tags/x_update.png");
            }
            else
            {
                labelX.SetTitle(dispName, UIControlState.Normal);
                tag.Image = null;
            }

            label.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Normal);
            labelX.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Normal);
            label.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Highlighted);
            labelX.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Highlighted);

            if (indexPath.Row == (int)controller.TypesIndexPath.Row)
            {
                label.SetTitleColor(Utility.ThemeColor, UIControlState.Normal);
                labelX.SetTitleColor(Utility.ThemeColor, UIControlState.Normal);
            }

            return(cell);
        }
        void UpdateSelectionForCell(UICollectionViewCell cell)
        {
            if (cell == null)
                return;

            bool isSelected = cell.Selected;

            UIImageView imageView = (UIImageView)cell.ViewWithTag (999);
            imageView.Layer.BorderColor = View.TintColor.CGColor;
            imageView.Layer.BorderWidth = isSelected ? 2 : 0;

            UILabel label = (UILabel)cell.ViewWithTag (998);
            label.TextColor = isSelected ? View.TintColor : UIColor.White;
        }