예제 #1
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell (cpkey);
            if (cell == null){
                cell = new UITableViewCell (UITableViewCellStyle.Subtitle, cpkey);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            } else
                RemoveTag (cell, 1);

            if (control == null)
            {
                if (colorSelections != null)
                {
                    control = new SegmentControl(colorSelections);
                    control.ColorSelected += delegate(UIColor selectedColor, UIColor previousColor) {
                        if (ColorSelected != null) ColorSelected(selectedColor);
                    };
                }
                else if (unselectedImages != null)
                {
                    control = new SegmentControl(unselectedImages, selectedImages);
                    control.ImageSelected += delegate(int imageIndex) {
                        if (ImageSelected != null) ImageSelected(imageIndex);
                    };
                }
            }
            else control.SetNeedsDisplay();

            cell.AccessoryView = control;
            cell.TextLabel.Text = Caption;

            return cell;
        }
예제 #2
0
        public override UITableViewCell GetCell(UITableView tv)
        {
            var cell = tv.DequeueReusableCell(cpkey);

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Subtitle, cpkey);
                cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            }
            else
            {
                RemoveTag(cell, 1);
            }

            if (control == null)
            {
                if (colorSelections != null)
                {
                    control = new SegmentControl(colorSelections);
                    control.ColorSelected += delegate(UIColor selectedColor, UIColor previousColor) {
                        if (ColorSelected != null)
                        {
                            ColorSelected(selectedColor);
                        }
                    };
                }
                else if (unselectedImages != null)
                {
                    control = new SegmentControl(unselectedImages, selectedImages);
                    control.ImageSelected += delegate(int imageIndex) {
                        if (ImageSelected != null)
                        {
                            ImageSelected(imageIndex);
                        }
                    };
                }
            }
            else
            {
                control.SetNeedsDisplay();
            }

            cell.AccessoryView  = control;
            cell.TextLabel.Text = Caption;

            return(cell);
        }